Sha256: 1c8bbfdcd86d458ea5006f824444b69ac60e5c3196e35cee48d6aeb75131162f

Contents?: true

Size: 465 Bytes

Versions: 7

Compression:

Stored size: 465 Bytes

Contents

require 'singleton'

module Erector
  class Cache
    include Singleton

    def []=(*args)
      value = args.pop
      ::Rails.cache.write(transform_key(args), value.to_s)
    end

    def [](*args)
      ::Rails.cache.read(transform_key(args))
    end

    def delete(*args)
      ::Rails.cache.delete(transform_key(args))
    end

    def transform_key(args)
      ActiveSupport::Cache.expand_cache_key(args.reject { |x| x.nil? }, 'erector')
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
erector-rails4-0.1.1 lib/erector/cache.rb
erector-rails4-0.1.0 lib/erector/cache.rb
erector-rails4-0.0.7 lib/erector/cache.rb
erector-rails4-0.0.6 lib/erector/cache.rb
erector-rails4-0.0.5 lib/erector/cache.rb
erector-rails4-0.0.4 lib/erector/cache.rb
erector-rails4-0.0.3 lib/erector/cache.rb