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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...