# Purge Cache

Once a file is delivered through CDN Link, that means the file is distributed to 200+ Cloud Cache servers around the world and also stored in our internal caches.

Let's say you have a published image called `john.imagemash.io/w_100/logos/logo.png`, even if you delete the object from your storage or rename it, the file will be accessible from `john.imagemash.io/w_100/logos/logo.png`. Because it is still a valid file in Caches.\
\
Then you have a couple of options to overcome this situation.

* Add a dummy query to your file. (Random string. Split with `?` )\
  Eg. john.imagemash.io/w\_100/logos/logo.png<mark style="color:green;">?1234</mark>
* Change the name of your file and use the new one. Eg. `/logos/logo_v2.png`
* Change the folder of your file. Move, copy, or upload to another directory and use the new one. Eg. `/newLogos/logo.png`
* **Use Cache Purging. Read below.**

In order to purge caches, you have 2 options:

* By creating a new purge request through your Dashboard
* By using our [Purge Cache API](/api/api-methods/storage/purge-cache.md)

### Purge path requirements

In order to purge a file or path, your input <mark style="background-color:orange;">**should satisfy at least 1**</mark> of the conditions below

{% hint style="info" %}
imagemash will purge all of your files whose paths begin with your input. Consider your input as a search string.
{% endhint %}

1. **The `path` should be the complete path of the file.**\
   That means a valid file path and an extension should exist.\ <mark style="color:green;">Valid Examples:</mark>\
   :white\_check\_mark: `/logo.png`\
   :white\_check\_mark: `/company/logo.png`\ <mark style="color:red;">Invalid Examples:</mark>\
   :x:`/logo`\
   :x:`/company/`\
   :x:`/logo.png/`
2. **The path should be at least 15 characters long.**\
   That means it could be a complete path, part of the path, or an incomplete path.\ <mark style="color:green;">Valid Examples:</mark>\
   :white\_check\_mark: `/companies/my_company`\
   :white\_check\_mark: `/companies/my_com` (It will purge all file paths that start with this value)\
   :white\_check\_mark: `/my_image_repository`\
   :white\_check\_mark: `/my_image_repository/`\
   :white\_check\_mark: `/img.png` (Valid because it satisfies the first condition)\ <mark style="color:red;">Invalid Examples:</mark>\
   :x:`/logo`\
   :x:`/company/`\
   :x:`/company/imgs`
3. **The path should be nested in at least 2 folders.**\
   That means it could be a complete path, part of the path, or an incomplete path.\ <mark style="color:green;">Valid Examples:</mark>\
   :white\_check\_mark: `/img/big/`\
   :white\_check\_mark: `/img/big/my_` (It will purge all file paths that start with this value)\
   :white\_check\_mark: `/img/big/logo.png`\
   :white\_check\_mark: `/my_company_big/` (Valid because it satisfies the second condition)

   <mark style="color:red;">Invalid Examples:</mark>\
   :x: `/companies/`\
   :x: `/company/`\
   :x: `/company/imgs`

{% hint style="warning" %}
All users have a monthly limit of 500 cache purge requests. Please contact us if you need more limits.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imagemash.io/how-it-works/purge-cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
