Class: Rack::Dedos::Cache
- Inherits:
-
Object
- Object
- Rack::Dedos::Cache
- Defined in:
- lib/rack/dedos/cache.rb
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(url:, expires_in: nil, key_prefix: nil) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(url:, expires_in: nil, key_prefix: nil) ⇒ Cache
Returns a new instance of Cache.
7 8 9 10 11 12 13 14 |
# File 'lib/rack/dedos/cache.rb', line 7 def initialize(url:, expires_in: nil, key_prefix: nil) @url, @expires_in = url, expires_in @key_prefix = ("#{key_prefix}:" if key_prefix).to_s type = url.split(':').first extend Object.const_get("Rack::Dedos::Cache::#{type.capitalize}") rescue NameError raise(ArgumentError, "type of cache for `#{@url}' not supported") end |