You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom Age Threshold On Cache Objects Over Capacity聽#507
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.
Activity
maugustosemperfi commentedon Jan 22, 2026
Suggestion changes made on #506