
I have a database on appwrite which is not updated very frequently. Currently to display the data in my app, I have to fetch the documents from appwrite every time the app is launched. To optimize this, I want to create a local database in my app to cache the documents so that it can fetch the data from the local database instead of Appwrite, each time. But I want to know, if I update my database on Appwrite, how do I push the updates to my app's local database. What I want to do is, whenever the Appwrite database is updated, I want to trigger a "push" to the app's local database so that it remains updated. How do i accomplish this?

There are 2 ways to do this -
- Use appwrite’s
Realtime
api & update the local cache on update callback. - Create a Function that is triggered when there is a change in the database, send a sort of
FCM
silent notification to the app, update local on the received event. This requires dependency onFCM
though.

A problem with FCM here is that it won’t work on devices without Google Play Services. So a realtime connection is recommended.

Can you provide some directions as to how should I create a function for this task?

How much data do you have?

Does the data on the device need to be updated while the device is in the background?

currently it's only 10 documents with 5 attributes but it could grow to about 500 documents

no not necesarrily

That's not too bad. I had 10k documents with a lot of data and the app ended up needing over a gig of space 😆

yeah I am creating an RSS reader app so I just need to store data about some RSS feeds which will not be updated that frequently

Sooo we're in an awkward place right now because our website has been updated for Appwrite 1.4 but cloud isn't on 1.4 yet...

Any rough estimate for when the cloud will be updated to 1.4 ?

Maybe next week

You can start reading the docs: https://appwrite.io/docs/functions

Alright thanks!!
Recommended threads
- Doing the React TMDB movies tutorial, is...
At the point where I created a brand new app on appwrite but cannot instantiate the react platform without cloning a whole other app and doing some ping button ...
- ❗[Help] Function stuck in "waiting" stat...
Hi Appwrite team 👋 I'm trying to contribute to Appwrite and followed the official setup instructions from the CONTRIBUTING.md guide to run the platform locall...
- Unable to create push providers - FCM or...
Currently unable to create a push provider for FCM or APNS.... https://github.com/appwrite/console/issues/2045 When uploading a file... FCM = Valid file retu...
