Definition of Caching and its setting in ArvanCloud CDN Panel - ArvanCloud

ArvanCloud Blog

Read more about ArvanCloud news,
updates, products and services in ArvanCloud weblog.

Definition of Caching and its setting in ArvanCloud CDN Panel

7 Aug 2019

Caching is the temporary storage of documents and website data in order to optimize the website performance and decreases the delay.

In ArvanCloud CDN, the website data is cached in several points and layers for a faster accessibility, higher performance, and higher availability.

If the user’s requested data is not available in CDN, the user’s request will be sent to the Origin server and after the response is saved, the future requests to the same content will not be sent to the main server anymore, but it will be responded from Cache (except cases like revalidation).

It should be considered that all web data cannot be cached and some requests must repeatedly connect to the origin server. Usually static data such as JS and CSS files are cached.

The data that is responded from Cache is called “Hit” and if it is not valid inside the cache and it is required to connect to the origin server to fetch it, it is called “Miss”.

To evaluate the Miss or Hit value of the data, you need to review a response header called “ar-cache”

To review the response headers, you can go to Chrome browser > Setting > More Tools > Developer Tools.

In ArvanCloud CDN Panel there are different settings for caching. We will explain them in details here.

Cache Mode

In ArvanCloud panel you can set different Caching modes for your website.

  • Disable: in this mode no data will be cached and all the requests will be sent to the origin server.
  • Ignore Query String: in this mode the query string in the URL will be ignored. All the sent requests  with different Query strings to a URL will be responded with the same content from cache.

For example:

If the request:

is sent to the CDN before and stored in the cache:

The request will be responded from cache (it will be a Hit).

  • Apply Query String: in this mode, unlike the previous mode, all the query strings will be considered and 2 requests with different query strings to the same URL will be stored in cache in form of 2 different contents. Hence, if we consider the 2 previous examples, it will be a Miss.
  • Apply cookie + Query String: in this mode, the cookie value in the Request header will be considered as well as the query string,

For example a request to a URL with a cookie value is like this:

Cookie: test=123; other=abc

We want the stored amount of data in cache to be different compared to the “test” variable in cookie. So we should just set “test” in the cookie variable. In this scenario, of a request is send to the same URL address with the mentioned header below, the result will be a Miss:

Cookie: test=567; other=abc

If the customized variable in the cookie is empty, the cookie will not be considered.

It is also possible to consider part of the Query String for cache. You just need to disable the “all query strings” option and set your customized variables in the Query String section of the panel.

Validity Time of the Cached data

In this part of the panel (in the photo), click on the advanced setting.

Validity of the Cached files: the time that stored data will remain in cache. After this time, the data will be removed rom cache.

Cached data in browser: The time a browser is allowed to cache data.

Cached pages with set-cookie: if this feature is disabled, the responses from server with set-cookie header won’t be cached and if this feature is on, these pages with be cached.

Deleting Cache Data

Sometimes the cache data need to be deleted. There are two methods to do this in ArvanCloud Panel.

  • Selective Deleting of the files: if you want to remove specific files, by clicking on this option you can enter the URL address and selectively remove those files.
  • Removing All: clicking this option allows you to dele all your cached data on a domain.

Permanent Access

Enabling this option, allows ArvanCloud CDN to show the latest cached data of your website in case it is out of reach or offline,

When a website is out of reach or offline, it is not possible to cache any new data in CDN, so before such an issue occurs, you can do the right settings to indicate which data should be cached.

Developer Mode

By turning on this feature you can temporarily deactivate the caching. But the previously cached data will remain the same and won’t be removed. After disabling this feature the requests will be responded from cache again.

دیدگاه شما