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 policies to CachedTool #792

Merged
merged 5 commits into from
Oct 2, 2024
Merged

Conversation

realdavidvega
Copy link
Contributor

@realdavidvega realdavidvega commented Oct 2, 2024

Background

The existing implementation of the CachedTool abstract class supports caching and some criteria to determine the usage and writing on cache. However, there's no customization on the cache eviction and expiration. by default, there's only write timestamp, and cache eviction happens for the found key only.

This PR

  • Adds two timestamps for CachedToolValue, one for access and other for write.
  • Adds CacheExpirationPolicy to expire by write timestamp or access timestamp. By default it is WRITE.
  • Adds CacheEvictionPolicy to evict only the found key, or to evict all expired entries. By default it is ALL.
  • Introduces logic adjustments in the cache method in order to make work this new features.

@realdavidvega realdavidvega self-assigned this Oct 2, 2024
@realdavidvega realdavidvega merged commit c5dc939 into main Oct 2, 2024
6 checks passed
@realdavidvega realdavidvega deleted the feature/cache-policies branch October 2, 2024 12:39
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.

3 participants