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
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
dragonfly-0.8.6 extra_docs/Caching.md
dragonfly-0.9.14 extra_docs/Caching.md
dragonfly-0.9.13 extra_docs/Caching.md
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md
classiccms-0.5.17 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Caching.md