Closed Kyu closed 1 year ago
what's your use case?
My api has an exposed last_updated key, which returns a datetime
I plan to ping that last_updated endpoint on sync and check if its greater than the local last_updated. If its not, then the sync function will return the current local version of the key, as nothing has changed.
This is to save user bandwith
This sounds weird, and i've never seen such design. Why bother to check the last_updated on client? Why not do it on server? in this way:
The server has no way of knowing if the client has the most updated info.
edit: I guess client could send server the datetime, but that's not needed
I could check via auth, but users are not required to authenticate to log in
edit: I plan to use websockets in the future, but right now checking and updating seems like a good temporary solution.
even with your solution where the server returns null, I need a way to tell the cache to refresh the current version of data
sounds you still need a custom request interceptor instead of simple storage sync
i just want a way to refresh the expiry date of an object without making an expensive call. I will try to create my own fork with this functionality.
Edit: for future readers, I just set all my keys to never expire, and gave every object its own expiry field. On loading an object, i check the expiry, and if it expired, i check the server for any updates. If no updates, I refresh the expiry
Is it possible to get the details of an expired key?
or, if not, is it possible to load the current expired object inside of the
sync
function?