Class: ActiveSupport::Cache::MonetaStore
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::MonetaStore
- Defined in:
- lib/active_support/cache/moneta_store.rb
Instance Method Summary collapse
- #clear(options = nil) ⇒ Object
- #decrement(key, amount = 1, options = nil) ⇒ Object
- #increment(key, amount = 1, options = nil) ⇒ Object
-
#initialize(options = nil) ⇒ MonetaStore
constructor
A new instance of MonetaStore.
Constructor Details
#initialize(options = nil) ⇒ MonetaStore
Returns a new instance of MonetaStore.
5 6 7 8 9 10 |
# File 'lib/active_support/cache/moneta_store.rb', line 5 def initialize( = nil) raise ArgumentError, 'Option :store is required' unless @store = .delete(:store) @store = ::Moneta.new(@store, expires: true) if Symbol === @store super() extend Strategy::LocalCache end |
Instance Method Details
#clear(options = nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/active_support/cache/moneta_store.rb', line 26 def clear( = nil) = () instrument(:clear, nil, nil) do @store.clear(()) end end |
#decrement(key, amount = 1, options = nil) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/active_support/cache/moneta_store.rb', line 19 def decrement(key, amount = 1, = nil) = () instrument(:decrement, key, amount: amount) do @store.increment(namespaced_key(key, ), -amount, ()) end end |
#increment(key, amount = 1, options = nil) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/active_support/cache/moneta_store.rb', line 12 def increment(key, amount = 1, = nil) = () instrument(:increment, key, amount: amount) do @store.increment(namespaced_key(key, ), amount, ()) end end |