
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
- This morning the project was deleted.
Hello, We had a project transfer a month ago and my customer told me that the project was deleted today. How can I get help for this. Yours sincerely,
- Database error
My code: await databases.createDocument( process.env.APPWRITE_DATABASE, process.env.APPWRITE_COLLECTION_USER, data.userId, ...
- API preflight request not working on .f...
When I am calling a function on my APP through the domain is failing. Because the preflight request (OPTIONS HTTP request) times out. this only occurs with fu...
