Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cache Storage Size Limit #58

Open
nathnaeld opened this issue Jun 6, 2024 · 1 comment
Open

Add Cache Storage Size Limit #58

nathnaeld opened this issue Jun 6, 2024 · 1 comment

Comments

@nathnaeld
Copy link

nathnaeld commented Jun 6, 2024

Feature Request:
Please add a configurable cache storage size limit. This feature would allow to set a maximum cache size, preventing excessive storage usage.

Use Case:
In apps displaying many images, the cache can grow too large, consuming too much storage. A size limit would help manage storage more effectively.

Proposed Implementation:

  • Add a parameter for maximum cache size (in bytes) to the configuration:
  await FastCachedImageConfig.init(
    subDir: storageLocation,
    clearCacheAfter: const Duration(days: 7),
    maxCacheSize: 100 * 1024 * 1024, // Example: 100 MB
  );
  • Implement logic to remove the least recently used items when the cache exceeds this limit.
@nathnaeld nathnaeld changed the title Add Cache Storage Size Limit Feature Add Cache Storage Size Limit Jun 6, 2024
@escamoteur
Copy link

IMHO it should have two options max-images and max-size. which ever is reached first should trigger deletion of the the oldest entries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants