dragonfly-cache is a cache adapter for Dragonfly. It allows you to store Dragonfly's jobs results without running them again and again on each call.
dragonfly-cache supports only local caching of local files. It will be extended in a near future to support remote cache and file storages.
dragonfly-cache to your application's Gemfile:
And then execute:
Or install it yourself as:
gem install dragonfly-cache
Once installed, you should configure
dragonfly-cache to set your application's root (
/public by default, if the directory exists) and your cached url format (
/dragonfly-cache/:sha/:name by default).
Dragonfly.app.configure do plugin :dragonfly_cache, server_root: Rails.application.root.join('public'), url_format: '/media-cache/:sha/:name' end
Configured as this, cached files will be stored in
:name is the Dragonfly
:name attribute of the attached file and
:sha is a contraction of the job SHA params.
dragonfly-cache will try to do its best to shorten the
:sha part of the url and prevent cache conflicts.
How does it work?
dragonfly-cache use a method similar to the one described in the Dragonfly documentation to process files on-the-fly and serve them remotely but use only
The dragonfly photography used in specs is a work from André Karwath and is licensed under the Creative Commons Attribution-Share Alike 2.5 Generic license.