Git Product home page Git Product logo

dragonfly-cache's Introduction

dragonfly-cache

Unit tests Gem Version

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.

For now, dragonfly-cache supports only local caching of local files. It will be extended in a near future to support remote cache and file storages.

Installation

Add dragonfly-cache to your application's Gemfile:

gem 'dragonfly-cache'

And then execute:

bundle install

Or install it yourself as:

gem install dragonfly-cache

Configuration

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 /public/media-cache/:sha/:name, where :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 define_url.

Credits

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.