https://kotlinlang.org logo
a

agrosner

09/06/2022, 1:49 PM
👋 hey i am thinking of implementing pagination using the new incubating cache artifacts. is there any good examples combining cache, pagination, and
watch
?
j

John O'Reilly

09/06/2022, 1:54 PM
I think @bod had been looking at this as well?
m

mbonnin

09/06/2022, 3:10 PM
The parent folder contains examples for various kinds of pagination (offset, cursor, relay, etc...)
a

agrosner

09/06/2022, 3:15 PM
i saw that. what i am trying to understand is , when I watch a query with pagination parameters (say a limit, offset), when I watch it, will it watch the entire set of data in the cache, or only the first x number of records?
m

mbonnin

09/06/2022, 3:16 PM
It'll watch the entire set of data
That's the main goal actually. It does this by ignoring the pagination parameters in the cache key
So everything is "accumulated" in the same cache key
a

agrosner

09/06/2022, 3:19 PM
oh awesome . so my next follow up is, when I use something like androidx pagination, how do this change the equation? in the sense that we watch the entire set. but with androidx pagination, im guessing we just invalidate the source when the
watch
emits?
m

mbonnin

09/06/2022, 3:24 PM
Right, excellent question for which I don't have an excellent answer...
a

agrosner

09/06/2022, 3:39 PM
ah i see. so using
query
still, but pulling from cache or network at will. interesting!
14 Views