Web Developer
Greetings, my name is Rodrigo and I'm working on a project where I have three collections as shown in the image below.
The 'user' collection has user information, the 'product' collection has product information, and they have
a 1-n relationship in both ways, so a user can obtain multiple different products subscriptions
and a product may have several subscriptions from different users. To deal with this, I decide to create
another collection called 'users_subscription' to be able to handle these relationships.
The 'users_subscription' collection has an index on the 'id_product' attributes.
I have a function that is called periodically to inform me of users who have a particular subscription
product, where I pass the product id and receive an array with the data of users who have a subscription.
Below is an example of the function I am using to query the database.
My question is about using the cache in appwrite, and how do I use it in my queries, as I have
fear that when the project scales, the search time will increase significantly due to the number of documents in the collection.
The way I'm doing it, am I already using the cache? If not, how and what methods would I use to be able to
make use of the appwrite cache.
I would also like to know if there is any other approach to solving this problem.
Thank you very much for your attention!