Custom Age Threshold On Cache Objects Over Capacity
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
Research direction
Locate Config and getObjectsOverCapacity, then trace where the hardcoded one-day Duration is used during cleanup. Add the optional duration while preserving the one-day default, support custom values such as 12 hours, and verify cache cleanup still respects the configured threshold.
Written by the indexing model from the issue text.
Description
🏗 Enhancement Proposal
Allow configuring the age threshold used when cleaning up cache objects over capacity.
Pitch
Currently, getObjectsOverCapacity uses a hardcoded Duration(days: 1) to filter which cached objects are eligible for removal during cleanup. This means objects touched within the last 24 hours are never removed, even if the cache exceeds its capacity.
This can be problematic in scenarios where:
- Apps have high cache turnover and need more aggressive cleanup (e.g.,
Duration(hours: 6)) - Apps want to preserve recently accessed items for longer periods (e.g.,
Duration(days: 7)) - The 1-day threshold doesn't align with the app's usage patterns
Proposed solution:
Add an optional maxCapacityAgeFilterDuration parameter to Config that allows developers to customize this threshold. The parameter defaults to Duration(days: 1) to maintain backward compatibility.
CacheManager(
Config(
'customCacheKey',
maxCapacityAgeFilterDuration: Duration(hours: 12), // Only remove items untouched for 12+ hours
),
);
This gives developers fine-grained control over cache eviction behavior without changing the default experience.
Platforms affected (mark all that apply)
- 📱 iOS
- 🤖 Android
- Dominant language
- Dart
- Stars
- 810
- Forks
- 510
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Baseflow/flutter_cache_manager
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Baseflow/flutter_cache_manager#450 · 9 comments · 8 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
Baseflow/flutter_cache_manager#501 · 1 comment · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Baseflow/flutter_cache_manager#500 · 1 comment · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
Baseflow/flutter_cache_manager#495 · 1 comment ·
All issues in Baseflow/flutter_cache_manager
Similar issues
-
improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linagora/tmail-flutter#4849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
hiddify/hiddify-app#2348 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
mlcommons/mobile_app_open#1182 ·
-
[Bug] Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bggRGjQaUbCoE/PiliPlus#3048 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
zulip/zulip-flutter#2466 ·