-
Notifications
You must be signed in to change notification settings - Fork 2
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: Cache Control (also known as Time to Live, Expiration) #52
Comments
Hi, it sounds like this ticket is to support expiry on a query level. |
@ynkm169 the idea here was to control the expiry per type rather than per query or fragment. Since several queries and fragments can contribute the same fields to the cache I'm not entirely sure how this would work - but don't hesitate to tell us more about your use case and the possible API you envision. |
@BoD Hi, per type work as well.
|
@ynkm169 situations where you will get a cache miss even though some fields are present in the cache can still happen. If a field is expired, it should behave like it is missing, and so this will result in a cache miss as well. For instance: query getProduct {
product(42) {
description { title }
inventory { quantity }
}
} If |
Hi, to clarify.
apollographql/apollo-kotlin#1 will serve as a mechanism to provide default expiry on a type |
I think 2. should be possible but it could be hazardous in the sense that if your field correspond to a record that is also returned by another query (cache key based on its id for instance), then this could lead to unpredictable results. |
apollographql/apollo-kotlin#2. There are many cases regarding expiry specified in different locations that may affect the same cache entry.
I think this may introduce unwanted behaviors. A surface/API expect a particular cache entry to expire in 1 minute, another surface/API may modify this entry's expiry to 30seconds or 2 minutes. Based on above, I think we wouldn't need apollographql/apollo-kotlin#2 at all. |
Hi, is there an approximate timeline in terms of having this declarative cache expiry feature available for memory cache? Is it on the near term roadmap say within a 6 months timeline? Thanks! |
Our current focus is on version 4 which currently doesn't include this, and is expected to land around ~ Autumn 2023 (see the roadmap), and then we'll probably work again on this area after that. |
This is available in SNAPSHOTs: repositories {
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
mavenCentral()
// other repositories...
} Documentation is at https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/expiration.html. Feedbacks warmly welcome. |
This is now available in v0.0.4. Leaving the issue open to gather any feedback you may have 🙏 |
In v0.0.4, a Cache Control feature has been added.
It allows to store a received or expiration date along with the fields of a record. The application can then configure max ages to types and fields, and can control what happens when resolving a field that is stale according to the stored date and field's max age.
Pleas use this ticket to give any feedback or questions regarding that feature.
The text was updated successfully, but these errors were encountered: