-
Notifications
You must be signed in to change notification settings - Fork 657
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
Allow queries to be excluded from particular caches #3540
Comments
I'm thinking out loud here but I'm wondering if the ability to set an expiration date on cached models would also be a possible path to achieve your use-case? |
Yes, that could work too. This is a good point since it clarifies what I'm looking for. |
Expiration definitely sounds like something that would help here. That's on the roadmap but requires some work though. In the short term, you can always implement your own class MyCache(val delegate: NormalizedCache): NormalizedCache() {
override fun merge(record: Record, cacheHeaders: CacheHeaders): Set<String> {
if (cacheHeaders.hasHeader("DO_NOT_STORE_SQLITE")) {
return emptySet()
}
return delegate.merge(record, cacheHeaders)
}
override fun merge(records: Collection<Record>, cacheHeaders: CacheHeaders): Set<String> {
if (cacheHeaders.hasHeader("DO_NOT_STORE_SQLITE")) {
return emptySet()
}
return delegate.merge(records, cacheHeaders)
}
// ...
} |
I'm going to close this one as the solution above should work for the specific problem of exclude some queries from the SQLite cache. For the more general expiration problem, I just opened #3566 @davidalbers let us know if you want to dig more into excluding queries and I'll reopen this issue. |
Is your feature request related to a problem? Please describe.
I have an in-memory LRU cache chained to an on-disk SQL cache:
Most of the time I want this because I want most queries saved to disk. However, there are some queries I only want in the in-memory cache.
As an example, we show informational banners in our app. It makes sense to cache those in-memory so they don't constantly reload when navigating between screens. However, it's not necessary to keep them on disk since the information changes frequently. In fact, it could be a bug if the user sees a cached notification from 6 months ago.
Describe the solution you'd like
I'd like a cache header that skips the
SqlNormalizedCacheFactory
. I'm thinking along the lines ofDO_NOT_STORE
but more specificThough I could see a few different solutions here and open to anything that helps the original problem.
The text was updated successfully, but these errors were encountered: