Caching objects in a public bucket
When a user requests an object in a public bucket for the first time, the object is saved in the S3 cache. If an object is cached, upon a subsequent request, the user will receive it immediately from the storage cache server instead of from its backend server.
The cache is cleared automatically when an object body is changed; the caching system tracks changes using an MD5 hash.
You can change the caching settings for a bucket via the Cache-Control header—for example, to limit the cache lifetime or disable it.
To get the up-to-date version of an object, you can clear the cache manually—this will update the content on the cache server.
Clear cache
- In the control panel, on the top menu, click Products and select S3.
- Go to the Cache Purge section.
- Paste the links to each object for which you want to clear the cache.
- Click Clear cache.
Configure caching
- In the control panel, on the top menu, click Products and select S3.
- Go to the Buckets section.
- Open the bucket page → Configuration tab.
- In the Cache-Control field, enter the caching settings separated by commas—for example,
public, no-cache, private, max-age=31536000, where31536000is the maximum cache storage time in seconds. - Click Save.