-
Notifications
You must be signed in to change notification settings - Fork 658
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
💧 first drop for a SQLite backend that stores when each field was last updated #4104
Conversation
✅ Deploy Preview for apollo-android-docs canceled.
|
...che-api/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/CacheHeaders.kt
Show resolved
Hide resolved
apollo-normalized-cache-sqlite/api/android/apollo-normalized-cache-sqlite.api
Show resolved
Hide resolved
...-sqlite/src/commonMain/sqldelight/blob/com/apollographql/apollo3/cache/internal/blob/blob.sq
Show resolved
Hide resolved
...ommonMain/kotlin/com/apollographql/apollo3/cache/normalized/sql/sqlNormalizedCacheFactory.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On thing that I'm not entirely sure I understand: the date stored along with fields - with the MaxAgeCacheResolver
they're meant to represent the time at which they were received, right? But with a different Resolver, they could also represent an expiration date in the future (whose value could come from the server), right? So it is a generic date - its usage can adapt to needs?
apollo-mpp-utils/src/appleMain/kotlin/com/apollographql/apollo3/mpp/utils.kt
Show resolved
Hide resolved
...che-api/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/CacheHeaders.kt
Show resolved
Hide resolved
...he-api/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/CacheResolver.kt
Outdated
Show resolved
Hide resolved
...he-api/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/CacheResolver.kt
Show resolved
Hide resolved
...zed-cache-api/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/Record.kt
Show resolved
Hide resolved
...ommonMain/kotlin/com/apollographql/apollo3/cache/normalized/sql/sqlNormalizedCacheFactory.kt
Outdated
Show resolved
Hide resolved
...-sqlite/src/commonMain/sqldelight/blob/com/apollographql/apollo3/cache/internal/blob/blob.sq
Show resolved
Hide resolved
apollo-runtime/src/appleMain/kotlin/com/apollographql/apollo3/internal/dispatchOnMain.kt
Outdated
Show resolved
Hide resolved
Excellent question. At the moment it's mostly the receive time. We could store the expiration time too I guess. It wouldn't be too hard I think. Something I want to improve is to make sure a given database is always open with the same assumption (blob vs json, date vs expire). I'll suggest something |
Also closes #3758 |
e284351
to
383a03c
Compare
…aphql/apollo3/cache/normalized/api/internal/BlobRecordSerializer.kt Co-authored-by: Benoit Lubek <[email protected]>
Co-authored-by: Benoit Lubek <[email protected]>
Co-authored-by: Benoit Lubek <[email protected]>
See #3566
First drop for a SQLite backend that stores when each field was last updated. It introduces a new SQLite table that stores Records in a binary format that also holds the last updated timestamp.
This allows to throw a cache miss when a given field is older that a configured max-age
Next steps: