Back

How to cache listDocuments response with android sdk?

  • 0
  • Android
  • Databases
  • Cloud
mayank.12
8 Oct, 2023, 04:34

I want to cache listDocuments response for a given time like 1 hour to optimize appwrite function calls. How to do this. Is it supported natively or do I have to use other third party libraries?

TL;DR
There is no native support to cache listDocuments response with the Android SDK. You will need to manually implement a caching mechanism. One option is to use RoomDB, which is a library for local storage in Android. Another option is to modify the ARC library, which mimics RemoteConfig from Firebase and can be customized according to your needs.
darShan
8 Oct, 2023, 05:42
  1. You will have to manually write an implementation to cache these results on disk. Example: RoomDB.
  2. I've created a library that mimics RemoteConfig from Firebase but only looks for 2 attributes, similar to key: value structure. You can use that if you have 2 attributes or maybe modify it according to your needs. Here it is: https://github.com/itznotabug/arc.

I'd suggest using RoomDB for managing a long list of docs. though.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more