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