Sha256: 8d94dc6f6d2d4ff16dbf17b52c1f82f9331157808e63a37d652cca9c55c120a5

Contents?: true

Size: 993 Bytes

Versions: 74

Compression:

Stored size: 993 Bytes

Contents

Caching
=======

Processing and encoding can be an expensive operation. The first time we visit the url,
the image is processed, and there might be a short delay and getting the response.

However, dragonfly apps send `Cache-Control` and `ETag` headers in the response, so we can easily put a caching
proxy like {http://varnish.projects.linpro.no Varnish}, {http://www.squid-cache.org Squid},
{http://tomayko.com/src/rack-cache/ Rack::Cache}, etc. in front of the app, so that subsequent requests are served
super-quickly straight out of the cache.

The file 'dragonfly/rails/images' puts Rack::Cache in front of Dragonfly by default, but for better performance
you may wish to look into something like Varnish.

Given a dragonfly app

    app = Dragonfly[:images]

You can configure the 'Cache-Control' header with

    app.cache_duration = 3600*24*365*3  # time in seconds

For a well-written discussion of Cache-Control and ETag headers, see {http://tomayko.com/writings/things-caches-do}.

Version data entries

74 entries across 74 versions & 4 rubygems

Version Path
dragonfly-0.8.4 extra_docs/Caching.md
oahu-dragonfly-0.8.2 extra_docs/Caching.md
fog-dragonfly-0.8.2 extra_docs/Caching.md
dragonfly-0.8.2 extra_docs/Caching.md
fog-dragonfly-0.8.1 extra_docs/Caching.md
dragonfly-0.8.1 extra_docs/Caching.md
dragonfly-0.8.0 extra_docs/Caching.md
dragonfly-0.7.7 extra_docs/Caching.md
dragonfly-0.7.6 extra_docs/Caching.md
dragonfly-0.7.5 extra_docs/Caching.md
dragonfly-0.7.4 extra_docs/Caching.md
dragonfly-0.7.3 extra_docs/Caching.md
dragonfly-0.7.2 extra_docs/Caching.md
dragonfly-0.7.1 extra_docs/Caching.md