Start a new topic

K1.24.0 Caching and Offline: merge policy?

First, thanks for the new release. Offline is now working as expected.

I have a question concerning the relation between caching and offline:

I have a case use where multiple entities are queued while offline, then my app goes online and start fetching entities already in the queue but with KCSCachePolicyNone. The queue is rather big and my process start from the last saved one. What happens if an entity is fetched before the same one already queued had a chance to be saved?

Are the query cache and the offline update queue separate objects? If so, how can I sync them? If I activate the KCSCachePolicyLocalFirst, will my requests use the queued entities or do I have to define some sort of a merge policy in KCSOfflineUpdateDelegate?

1 Comment

Everything is handled in FIFO order, however if object "X" is in the offline queue and the device is still offline, saving "X" again moves it to the back of the queue.

When an entity comes from the server, the cache is updated.

When a save happens it updates the cache both when the save API is first called and after the the request comes back the server.

For any given collection and `_id` there is only one object in the cache, so you if the object is changing outside of the client, you could see what is in the cache update a lot.

If you need to make sure the object most closely reflects what is on the server, either don't use the cache or use the NetworkFirst policy.
Login or Signup to post a comment