[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud CDN](../../index.md) > [Step-by-step guides](../index.md) > Resources > Purging resource cache

# Purging the resource cache

To [purge the cache](../../concepts/caching.md) of the resource:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where your resource is located.

  1. Navigate to **Cloud CDN**.

  1. Click the resource name.

  1. Navigate to the **Content** tab.

  1. In the top-right corner, click ![image](../../../_assets/console-icons/trash-bin.svg) **Purge cache**.

  1. Select the type of cache purging:

      * `Full`: To purge the cache for all files.
      * `Selective`: To purge the cache for selected files. In the **File path** field, specify comma-separated paths to the files.

          For partial purging, you can specify paths to individual files and folders. Each path must start with `/`. 
          
          {% note info %}
          
          The `*` wildcard character can only be used at the end of the path. If you specify `*` at the beginning or middle of a path, the cache for matching files will not be purged.
          
          {% endnote %}

  1. Click **Purge cache**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the description of the CLI command to update a resource:

      ```bash
      yc cdn resource update --help
      ```

  1. Get a list of all [CDN resources](../../concepts/resource.md) in the default folder:

      ```bash
      yc cdn resource list --format yaml
      ```

      Result:

      ```text
      id: s0me1dkfjq********
      folder_id: s0mef01der7p********
      cname: testexample.com
      created_at: "2022-01-19T09:23:57.921365Z"
      updated_at: "2022-01-19T10:55:30.305141Z"
      active: true
      options:
        edge_cache_settings:
          enabled: true
          default value: "345600"
        cache_http_headers:
          enabled: true
          value:
          - content-type
          - content-length
          - connection
          - server
          - date
          - test
        stale:
          enabled: true
          value:
          - error
          - updating
        allowed_http_methods:
          value:
          - GET
          - POST
          - HEAD
          - OPTIONS
      origin_group_id: "89783"
      origin_group_name: My origins group
      origin_protocol: HTTP
      ssl_certificate:
        type: DONT_USE
        status: READY
      ```

  1. Purge the file cache:

      ```bash
      yc cdn cache purge \
        --resource-id <resource_ID> \
        --path <file_path_1>,<file_path_2>,...,<file_path_n>
      ```

      Where:
      * `--resource-id`: ID of the CDN resource to purge cache in.
      * `--path`: List of paths to CDN resource files whose cache needs purging.

          For partial purging, you can specify paths to individual files and folders. Each path must start with `/`. 
          
          {% note info %}
          
          The `*` wildcard character can only be used at the end of the path. If you specify `*` at the beginning or middle of a path, the cache for matching files will not be purged.
          
          {% endnote %}

          If the CDN resource uses `Vary` headers (e.g., `Vary: Accept-Encoding`), you must add the `*` wildcard character to the end of the path when purging the cache to remove all possible cached versions of the files, e.g., `/image/foobar.png*`.

          If you omit the `--path` setting with paths to files, the cache of all resource files will be purged. For more information, see [Purging cache](../../concepts/caching.md#purge).

      For more information about the `yc cdn cache purge` command, see the [CLI reference](../../../cli/cli-ref/cdn/cli-ref/cache/purge.md).

- API {#api}

  Use the [purge](../../api-ref/Cache/purge.md) REST API method for the [Cache](../../api-ref/Cache/index.md) resource or the [CacheService/Purge](../../api-ref/grpc/Cache/purge.md) gRPC API call.

{% endlist %}
  
It may take up to 15 minutes to purge the cache.