Filestack Caching

There are four stages of caching in Filestack. The following are Filestack’s internal and external cache layers, with the first layer being the browser:

  1. The first layer is the browser cache. Whenever Filestack returns a file, whether it was converted or not, the file is loaded with a cache control response header telling the browser to cache the file.
  2. The second is S3. All previously converted files are loaded from Filestack’s S3 Bucket.
  3. Before a file is converted, it will be stored in Redis.
  4. If Filestack CDN links or a processing engine link is being used to access a file, then the first place we will look for the file is the closest Fastly Edge server, then our Fastly Shield will be checked, finally our API servers will be queried if the Fastly cache locations did not have a stored copy.

Javascript Example

var input = document.getElementById("read-input");
var output = document.getElementById("read-result");
if (!input.value) {
    console.log("Choose an image to read below");
} else {, {cache: true},
            output.src = 'data:image/png;base64,'+imgdata;
            console.log("Read successful");
        }, function(fperror) {
            //  console.log(FPError.toString()); - print errors to console

REST Example

>>> curl -I
HTTP/1.1 200 OK
Cache-Control: public, max-age=315360000, no-transform
>>> curl -I
HTTP/1.1 200 OK
Cache-Control: no-cache

Browser Caching In Filestack For Regular Files

The first kind of caching in Filestack is for regular and converted files. This kind of cache is set in a user’s browser, and allows setting a cache control header in their HTTP response. There are currently only two browser cache options. If cache=true, the file will be cached for 10 years. If cache=false, it will not be cached. If you are using processing engine links, you can set the expiration time manually down to the second.

Caching for Converted Files

If this were a new conversion, the first request to convert this file with its set of parameters would take a little extra time as the file is being processed.

Once a conversion request is completed, the converted file is delivered to Filestack’s S3, and the original file is stored in our Redis server. Additionally, these files are propagated to our Fastly shield and Fastly's network of edge servers.

Every subsequent request with the same parameters will be delivered from Fastly's Edge servers instead of being converted multiple times.

The original file is stored in Redis so that different conversion requests can be processed more quickly. This is instead of having to grab the file from its origin every time a new conversion request is made.

Every conversion result stays cached for 30 days. After that time it's removed and the process above will apply to any subsequent request with the same conversion parameters.