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
Realtimeapi & 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
FCMsilent notification to the app, update local on the received event. This requires dependency onFCMthough.
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
- how think about relationships?
From what I understand, relationships don't work like foreign keys. So, two things: Is the way to simulate foreign keys to manually pass references to IDs? In...
- Appwrite - Github student plan payment
Even though I have the GitHub Student package, I received a notification saying I would be switched to a pay-as-you-go plan. (It said that I could use AppWrite ...
- SMS - Github Student Pack
I have a project on Appwrite Github Student Pack but unable to send any message as I get error: "Phone authentication limit for your organization has exceeded. ...