Class: ActiveSupport::Cache::SimpleRedisStore
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::SimpleRedisStore
- Defined in:
- lib/active_support/cache/simple_redis_store.rb
Instance Method Summary collapse
- #clear(options = nil) ⇒ Object
- #decrement(name, amount = 1, options = nil) ⇒ Object
- #delete_matched(matcher, options = nil) ⇒ Object
- #increment(name, amount = 1, options = nil) ⇒ Object
-
#initialize(options = {}) ⇒ SimpleRedisStore
constructor
A new instance of SimpleRedisStore.
Constructor Details
#initialize(options = {}) ⇒ SimpleRedisStore
Returns a new instance of SimpleRedisStore.
11 12 13 |
# File 'lib/active_support/cache/simple_redis_store.rb', line 11 def initialize( = {}) super() end |
Instance Method Details
#clear(options = nil) ⇒ Object
34 35 36 37 38 |
# File 'lib/active_support/cache/simple_redis_store.rb', line 34 def clear( = nil) instrument(:clear, nil, nil) do execute(:flushdb) end end |
#decrement(name, amount = 1, options = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/active_support/cache/simple_redis_store.rb', line 28 def decrement(name, amount = 1, = nil) instrument(:decrement, name, :amount => amount) do execute(:decrby, name, amount) end end |
#delete_matched(matcher, options = nil) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/active_support/cache/simple_redis_store.rb', line 15 def delete_matched(matcher, = nil) instrument(:delete_matched, matcher.inspect) do return unless keys = execute(:keys, matcher) execute(:del, *keys) if keys.any? end end |
#increment(name, amount = 1, options = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/active_support/cache/simple_redis_store.rb', line 22 def increment(name, amount = 1, = nil) instrument(:increment, name, :amount => amount) do execute(:incrby, name, amount) end end |