Skip to content

How does stalePeriod work? #1026

@emiraksamyatmazsabahkalkmaz

Description

I passed a cacheManager to the CachedNetworkImage widget we are using.

To test whether the image is deleted from the cache or not, I set the stalePeriod to 5 seconds. Like this:

CachedNetworkImage(
      imageUrl: "myimagelink"
      cacheManager: CustomCacheManager.instance,
),

// ...

class CustomCacheManager {
  static const key = DefaultCacheManager.key;
  static CacheManager instance = CacheManager(
    Config(
      key,
      stalePeriod: const Duration(seconds: 5),
    ),
  );
}

However, the cache manager is not working as expected. If an image is cached and then not used for 5 seconds, shouldn't it be automatically deleted from the cache? We believe it should work this way. Or do we need to delete it manually?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions