Module: Rack::Cache::MonetaResolver Private

Includes:
Utils
Included in:
EntityStore::Moneta, Rack::Cache::MetaStore::Moneta
Defined in:
lib/rack/cache/moneta.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#resolve(uri) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rack/cache/moneta.rb', line 15

def resolve(uri)
  cache = Rack::Cache::Moneta[uri.to_s.sub(%r{^moneta://}, '')] ||=
    begin
      options = parse_query(uri.query).map do |key, value|
        [key.to_sym,
         case value
         when 'true'
           true
         when 'false'
           false
         else
           value
         end]
      end
      ::Moneta.new(uri.host.to_sym, options.to_h)
    end
  new(cache)
end