Skip to main content

Caching objects in a public bucket

Last update:

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

  1. In the control panel, on the top menu, click Products and select S3.
  2. Go to the Cache Purge section.
  3. Paste the links to each object for which you want to clear the cache.
  4. Click Clear cache.

Configure caching

  1. In the control panel, on the top menu, click Products and select S3.
  2. Go to the Buckets section.
  3. Open the bucket page → Configuration tab.
  4. In the Cache-Control field, enter the caching settings separated by commas—for example, public, no-cache, private, max-age=31536000, where 31536000 is the maximum cache storage time in seconds.
  5. Click Save.