Sha256: f018aaeca3e05b5d620cf30ab683ed9c18bff67530e69bf872941839faa87bbd
Contents?: true
Size: 1.08 KB
Versions: 18
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true # :enddoc: require "rack/cache" require "rack/cache/context" require "active_support/cache" module ActionDispatch class RailsMetaStore < Rack::Cache::MetaStore def self.resolve(uri) new end def initialize(store = Rails.cache) @store = store end def read(key) if data = @store.read(key) Marshal.load(data) else [] end end def write(key, value) @store.write(key, Marshal.dump(value)) end ::Rack::Cache::MetaStore::RAILS = self end class RailsEntityStore < Rack::Cache::EntityStore def self.resolve(uri) new end def initialize(store = Rails.cache) @store = store end def exist?(key) @store.exist?(key) end def open(key) @store.read(key) end def read(key) body = open(key) body.join if body end def write(body) buf = [] key, size = slurp(body) { |part| buf << part } @store.write(key, buf) [key, size] end ::Rack::Cache::EntityStore::RAILS = self end end
Version data entries
18 entries across 18 versions & 4 rubygems