Contentful logo

Contentful Community

I don't understand the caching, can someone please explain

#1

Hello!

I am building a pure frontend application useíng React and contentful.js. But my problem is that for some reason, our application makes a lot of request to the CDN API. Looking right now, we have already made over 335,000 requests in only three days. I need to look into why we are making so many requests.

I saw this text: “There are no limits enforced on requests that hit our CDN cache, i.e. the request doesn’t count towards your rate limit and you can make an unlimited amount of cache hits.” But I don’t understand what is meant with the “CDN cache”. Is that something I need to turn on? Or do I need to implement that myself?

I hope you don’t find this question stupid and may be able to help me understand this.

Best regards
Martin

0 Likes

#2

CDN cache is a proxy between your app and Contentful backend. It’s managed by Contentful and is always “turned on” for everybody who calls the API. When you make a request to the CDA, you should get a x-cache response header, which says whether the request HIT or MISS the cache.

0 Likes