Sha256: 5eee2db20ecb06851234d73dc03b50bc3b2e872b0e9d7ff9ec630cd56fb4d0e8

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module Scrivito
module Cache
  class FileStore
    include Chainable

    attr_reader :internal_store, :next_store

    def initialize(options = {})
      @internal_store = ActiveSupport::Cache::FileStore.new(
        options[:path] || Rails.root + 'tmp/scrivito_cache')
      @next_store = options[:next_store]
    end

    delegate :clear, to: :internal_store

    private

    delegate :read, to: :internal_store, prefix: :internal

    def internal_write(key, value, expires_in = nil)
      internal_store.write(key, value, expires_in: expires_in)
    end

    def forward_write?(key, value, expires_in)
      super && !expires_in
    end
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scrivito_sdk-0.60.0.rc1 lib/scrivito/cache/file_store.rb