Class: ActiveSupport::Cache::SimpleRedisStore

Inherits:
Store
  • Object
show all
Defined in:
lib/active_support/cache/simple_redis_store.rb

Instance Method Summary collapse

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(options = {})
  super(options)
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(options = 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, options = 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, options = 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, options = nil)
  instrument(:increment, name, :amount => amount) do
    execute(:incrby, name, amount)
  end
end