---
title: "Cache and results | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/dynamic-image/concepts/cache-and-results/"
---

# Cache and results

> This article describes what data is cached by Dynamic Image and explains a special kind of cached data: results. It also gives you an idea of how you can control cache and result storage.

## Cache

By default, the Dynamic Image caches all the required assets and intermediate calculations to speed up the image generation process. For example, if you populate a smart object in a PSD template with an image, and if during the next request you are passing the same image to the same smart object, it will use the cached version of this element. It will happen even if other parameters of the request are different. It allows Dynamic Image to work efficiently.

If for any reason you would like to turn off the caching mechanism for a specific request, you can use the query parameter `disableCache=true`.

```text
POST http://<your-DI-instance>/api/rendering/hires?disableCache=true
{
    "template": "flyer.psd",
    "data": {
        "Layer 1": {
            "type": "text", 
            "text": "Dynamic Image Rocks!"
        }
    }
}
```

To turn it off permanently, you may use the `EnableCache` parameter of the [dynamic-image/config-backend]. In this case, requests are not cached whether the `disableCache` key is presented or not. 

The cache is stored in **/App_Data/Cache/**, which is the default folder. To use another folder, redefine the `CachePath` and `FontCachePath` parameters in the [dynamic-image/config-backend].

You can also control the cache cleanup process. In the [dynamic-image/config-backend], `CacheExpirationTimespan` defines the cache lifetime, and `CacheMaxSize` defines the cache limit. Old files will be deleted from the cache when the cache size exceeds the limit or they exist longer than the expiration timespan.

## Results

When the Dynamic Image renders an image based on a template and input data, it stores the resulting images inside the application and returns a link to this image. For example, let's imagine we are sending a request to the Rendering API like this:

```text
POST http://<your-DI-instance>/api/rendering/hires
{
    "template": "flyer.psd",
    "data": {
        "Slogan": {
            "type": "text", 
            "text": "Dynamic Image Rocks!"
        }
    }
}
```

### How results are stored

Depending on the `SaveResultsToFileSystem` parameter in the [Dynamic Image Configuration](https://customerscanvas.com/docs/on-premises/dynamic-image/config-backend.md), the resulting PDF file will be created in either the cache or file system. By default, this parameter is `true`, and the file is stored in the **/App_Data/Results/** folder of your application.

:::note
**/App_Data/Results/** is the default folder. To save the result to another folder, redefine the `ResultHiresPath` and `ResultPreviewPath` parameters in the [Dynamic Image Configuration](https://customerscanvas.com/docs/on-premises/dynamic-image/config-backend.md).
:::

If results are stored in the file system, they are stored there forever until you explicitly remove them, as explained further. 

If `SaveResultsToFileSystem` is `false`, the results are stored in the cache. In this case, the result file lifecycle is controlled by the caching system. However, these files have dedicated settings for the size and expiration time for each file type. The `ResultHiresExpirationTimespan` and `ResultHiresMaxSize` config parameters are used for print files, while `ResultPreviewExpirationTimespan` and `ResultPreviewMaxSize` are used for preview images.

### Results API

Each result is identified by a unique string, which is used in the Results API. This API includes two endpoints.

The first one is the GET request [Dynamic Image API/DEFAULT/Results_Get] that downloads the result file:

```text
"http://<your-DI-instance>/api/results/download/1f78f1d8-cf23-45a0-ac47-ef57774cd435.pdf/"
```

This URL is returned after you send a rendering request such as [Dynamic Image API/DEFAULT/Rendering_Hires], [Dynamic Image API/DEFAULT/Rendering_Preview], [Dynamic Image API/DEFAULT/Rendering_MultipagePreview], and [Dynamic Image API/DEFAULT/Rendering_MultipageHires].

Another endpoint is [Dynamic Image API/DEFAULT/Results_Delete], and it specifically allows the user to delete a result:

```text
DELETE http://<your-DI-instance>/api/results/delete/1f78f1d8-cf23-45a0-ac47-ef57774cd435.pdf
{
    "headers": {"X-DynamicImageApiKey": "UniqueApiKey"}
}
```

:::note
Dynamic Image does not provide an API to list the files stored in the **Results** folder nor an API to delete all these files. So, to delete the resulting images, you must do so as soon as the images have been downloaded, organize a list of all rendered images, or delete files through the file system.
:::
