---
title: "Caching Objects in a Public Bucket"
sidebar_label: "Caching"
description: "How to set up caching and clear the cache manually"
sidebar_position: 8
---

import Formbricks from '@theme/MDXComponents/Formbricks'

# 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](#configure-cache) 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 \{#clear-cache}

1. In the [control panel](https://my.selectel.ru/storage/), 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 \{#configure-cache}

1. In the [control panel](https://my.selectel.ru/storage/), 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**.

<Formbricks />
