We are using cloud functions for returning aggregated data which internally is done using mongo aggregation queries. Looking into adding a simple caching mechanism to store response from cloud function in redis with function name and request params as key for the same.
Where do you want to cache? In the client side or in the server side?
server side. the blog wont let me post <20 char lol
There isn’t any hook for functions. So I see two options:
- In the beginning of the functions, verify the cache, and, at the end, save in the cache. You can try to override the default definition of the Parse.Cloud.define() function to write this logic a single time.
- Use some service like Cloudflare or CloudFront and setup it to do the cache for you.