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 refresh rate #580

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add cache refresh rate #580

wants to merge 4 commits into from

Conversation

tepinly
Copy link

@tepinly tepinly commented Jan 16, 2025

Cache refresh rate

The main idea behind the PR is to introduce cache invalidation for outdated cache by referring to :cache_refresh_period for the max duration in minutes.

  • Each hash record is stored with a cached_at element, indicating the time of caching
  • When fetching said record, we check whether the time between cached_at and that of fetching is greater than :cache_refresh_period
    • If it is, the cache is invalidated & refreshed from the database
    • If it isn't, the cache is returned normally

Implementation progress

  • Abstract the duration to a variable :cache_refresh_period
  • Implement it in single fetch
  • Implement it in multi fetch
  • Support non-hash value types
  • Add unit tests

@tepinly
Copy link
Author

tepinly commented Jan 16, 2025

I have signed the CLA!

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.

1 participant