Skip to content

Conversation

@maugustosemperfi
Copy link

@maugustosemperfi maugustosemperfi commented Jan 22, 2026

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Feature - Adds a new configurable maxCapacityAgeFilterDuration parameter to customize the age threshold for cache object cleanup.

⤵️ What is the current behavior?

When cleaning up cache objects over capacity, the getObjectsOverCapacity method uses a hardcoded Duration(days: 1) filter. This means only objects that haven't been touched in the last 24 hours are considered for removal, with no way to customize this behavior.

🆕 What is the new behavior (if this is a feature change)?

  • Added maxCapacityAgeFilterDuration optional parameter to Config
  • The getObjectsOverCapacity method now accepts a maxAge parameter
  • CacheStore uses the configured duration (falling back to 1 day if not set)
  • All repository implementations (CacheObjectProvider, JsonCacheInfoRepository, NonStoringObjectProvider) updated to support the new parameter

This allows users to configure how recently an object must have been accessed before it becomes a candidate for removal during over-capacity cleanup.

💥 Does this PR introduce a breaking change?

No - The parameter is optional with a default value matching the previous hardcoded behavior (Duration(days: 1)).

🐛 Recommendations for testing

  1. Create a cache manager with custom maxCapacityAgeFilterDuration (e.g., Duration(seconds: 10))
  2. Add objects exceeding capacity
  3. Verify only objects older than the configured duration are cleaned up
  4. Verify default behavior (no parameter) still uses 1 day threshold

📝 Links to relevant issues/docs

N/A

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current develop

Copy link

@Syed-Bipul-Rahman Syed-Bipul-Rahman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the feature for max capacity query

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

Successfully merging this pull request may close these issues.

2 participants