Method: Parse::Middleware::Caching#initialize
- Defined in:
- lib/parse/client/caching.rb
#initialize(adapter, store, opts = {}) ⇒ Caching
Creates a new caching middleware.
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/parse/client/caching.rb', line 77 def initialize(adapter, store, opts = {}) super(adapter) @store = store @opts = {expires: 0} @opts.merge!(opts) if opts.is_a?(Hash) @expires = @opts[:expires] unless [:key?, :[], :delete, :store].all? { |method| @store.respond_to?(method) } raise ArgumentError, "Caching store object must a Moneta key/value store." end end |