-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add caching option to client #83
Comments
Hi, The idea behind Contentful.js is to have a very thin layer on top of the API data to facilitate the usage, I can see the cache as an external component/extension that you can make it work with the SDK and not part of it. I will be glad to help to find a way to do that. Best, |
Hi Khaled, Thanks for the feedback. I'll take a closer look at the codebase to come up with some ideas. Will post here for feedback once I've come up with something. Felix |
Hi Felix, |
Hi too all! I used node-cache on several projects for this purposes, on the other one I used mongoDB |
Hi @RuLeZzz1987 , |
I am closing this issue for now, feel free to create another issue if you have more question |
Hi,
From my understanding of how querying the CDA through any of the SDKs or through HTTP directly works, any request to the server will count as an API request in the monthly quota of the user account.
To mitigate the problem of repeatedly exceeding the monthly quota at the company I work for, we added a cache to our our Contentful application. This cache uses the Contentful query options as keys. If we're able to find a cached value for a query object, we use that. If not, we make a request through the Contentful client. Of course you may flush the cache at any time and you can set things like the time-to-live etc.
Would you be be interested in having an optional cache integrated right into the Contentful client? I realize that such a feature would effectively enable users to bypass an otherwise paid part of your service. At the same time it seems like a useful feature and something people shouldn't necessarily have to implement themselves.
Please let me know what you think. I'd be happy to implement this myself and send you a pull request. Should you be open to this suggestion, let's discuss features. I have some ideas based on my experience with the API.
Thanks,
Felix
The text was updated successfully, but these errors were encountered: