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

[RFC]: Service Caching: provide an interface for invalidating an existing key #7003

Closed
1 task done
cannikin opened this issue Dec 1, 2022 · 0 comments · Fixed by #7016
Closed
1 task done

[RFC]: Service Caching: provide an interface for invalidating an existing key #7003

cannikin opened this issue Dec 1, 2022 · 0 comments · Fixed by #7016
Labels
release:feature This PR introduces a new feature topic/services

Comments

@cannikin
Copy link
Member

cannikin commented Dec 1, 2022

Summary

Although Service Caching was built to sort of mirror the Rails implementation of caching (which is, of course, perfect), there could be cases where you want to invalidate a key manually, rather than always trying to come up with a unique key. For example, if calling an updatePost service function, invalidate the key created in the post function.

Motivation

We gave a demo of Service Caching during office hours in Discord and @dthyresson brought up the idea of invalidating an existing key, specifically for a weird issue that came up with caching a post by it's id only, not including an updatedAt timestamp. There'd be no way to bust that cache, and actually trying to get the updatedAt stamp would mean we'd have to query the post to get it, which would defeat the purpose of the cache in the first place!

Detailed proposal

Look into memcached and Redis docs and figure out which API calls are used to invalidate a key, and call them in the individual clients. Then export that functionality from src/lib/cache.js. We need to come up with a good name...

  • invalidate
  • invalidateKey
  • clearKey
  • resetKey
  • clearCacheKey
  • resetCacheKey

Are you interested in working on this?

  • I'm interested in working on this
@cannikin cannikin added release:feature This PR introduces a new feature topic/services labels Dec 1, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot removed this from Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot removed this from Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot removed this from Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot removed this from Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Dec 7, 2022
@redwoodjs-bot redwoodjs-bot bot removed this from Main Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature topic/services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant