Skip to content
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

Closed
felixjung opened this issue Jul 21, 2016 · 6 comments
Closed

Add caching option to client #83

felixjung opened this issue Jul 21, 2016 · 6 comments
Labels

Comments

@felixjung
Copy link

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

@Khaledgarbaya
Copy link
Contributor

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,
Khaled

@felixjung
Copy link
Author

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

@Khaledgarbaya
Copy link
Contributor

Hi Felix,
Looking forward for your feedbacks
Best,
Khaled

@RuLeZzz1987
Copy link

RuLeZzz1987 commented Aug 1, 2016

Hi too all! I used node-cache on several projects for this purposes, on the other one I used mongoDB

@Khaledgarbaya
Copy link
Contributor

Hi @RuLeZzz1987 ,
Thanks for the input can you provide more infos about the implementation?
and can we do better to make the integration smoother.
Best,
Khaled

@Khaledgarbaya
Copy link
Contributor

I am closing this issue for now, feel free to create another issue if you have more question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants