Cache Infrastructure

Details about how your images are cached by Gumlet

We have created a multi-level caching infrastructure to ensure that images are delivered as fast as possible.

This also minimises the cost of fetching the image from origin and processing it again.

Origin Cache

As the name suggests, this cache keeps original images cached. There is no additional cost for this cache and it's always enabled for everyone using Gumlet.

Type

This cache is LRU cache with eviction time of 90 days. It means that if the file was not used in last 90 days for any transformations, we will delete the file from our cache.

Behaviour

Origin cache respects all the Cache-Control, ETag and Last-Modified headers from your origin server. It re-validates the cache in case it's expired using appropriate If-Modified-Since and If-None-Match headers.

Advantages

This cache ensures that origin server is not frequently accessed by Gumlet. Even when the re-validation is done, appropriate headers are sent to ensure that minimal data transfer is done. It helps minimise the cost of accessing origins especially for Amazon S3 which charges users based on number of requests and per GB data transferred.

Processed Cache

All processed images are cached by us to ensure that any repeat request for same image is served as fast as possible without any delays. There is no additional cost for this cache and it's always enabled for everyone using Gumlet.

Type

This cache expiration time is 6 months. Any processed file is cached for that duration and then evicted.

Behaviour

This cache works the same way a reverse proxy lilke NGINX would perform the cache. It respects all HTTP cache headers.

Advantages

CDNs generally don't keep each and every file cached for the duration spacified in cache-control headers. They generally evict the caches based on LRU mechanism. It results in cache hit ratios lower than 100%. We typically see the cache hit ratios of about 90%. This means that even if the image was already processed, CDNs will evict 10% of cache due to infrequent access.

Our processed cache infrastructure keeps all those images cached so that requests made by clients are served super fast.

CDN Cache

Our CDN provider CloudFront also performs cache on their end. The cache performed by them is according to s-maxage parameter provided in Cache-Contorl header. We currently set it at 180 days. Cache behaviour and eviction policy for this cache is decided by CloudFront.

Purge Cache

There might be instances when you want to purge cache for specific images. Our cache purging functionality helps you purge all 3 levels of cache described above. You can purge the cache either via dashboard or via API.

Dashboard

You can visit Sources tab on Gumlet dashboard. Please select the appropriate source for which the cache needs to be purged and then click Cache Management. You can provide an image URL for which you need to purge cache.

API

Our cache purge API can be used to clear cache programmatically. The documentation for the same can be found here.