Caching

Last Updated 16/09/2024

Content

What caching does and how it works?

Our caching system works by matching incoming requests to predefined rule configurations. If a match is found, we check for a cached copy of the response. If a cached copy exists, it is served to the user, bypassing the origin server. Otherwise, we request the content from the origin server and cache the response for future requests, provided certain conditions are met:

  • We do not cache responses containing a Set-Cookie header.
  • We only cache responses with status codes 200, 201, 204, and 206.
  • Only GET requests are eligible for caching.

Additionally, for image responses in PNG, JPEG, or JPG formats, we convert them to WebP if the rule configuration specifies a Time-To-Live (TTL) of more than 6 hours (21,600 seconds), optimizing image delivery for supported browsers. Last but not least, all responses are Brotli compressed, which can reduce response sizes by up to 90%, significantly enhancing load times and overall performance.

Cache Statuses

  • Miss: The requested content was not found in the cache, so it was fetched from the origin server.
  • Expired: The cached content has expired and was refreshed by fetching the latest version from the origin server.
  • Hit: The requested content was found in the cache and served directly without contacting the origin server.
  • Dynamic: The content is dynamic and not cached, requiring a fresh fetch from the origin server each time.
  • Bypass: The cache was deliberately bypassed, and the content was fetched from the origin server.
  • Block: The request was blocked and not fulfilled due to security or policy rules.

How can I see the cache status?

To view the cache status, open your browser's Developer Tools. Then, load the page of interest. Locate the resource you're interested in (usaually under the Network tab) and check the X-Arc2-Cache header value, which can be one of the following: Miss, Expired, Hit, Dynamic, Bypass, or Block. If it's a Hit, check the X-Arc2-Cache-Age header value to see the age of the resource in seconds.