Class: ActiveSupport::Cache::RedisClusterStore

Inherits:
RedisCacheStore
  • Object
show all
Defined in:
lib/active_support/cache/redis_cluster_store.rb

Instance Method Summary collapse

Instance Method Details

#delete_matched(matcher, options = nil) ⇒ Object



6
7
8
# File 'lib/active_support/cache/redis_cluster_store.rb', line 6

def delete_matched(matcher, options = nil)
  fail ::NotImplementedError, "Deleting keys with a matcher is not supported with redis cluster"
end

#fetch_multi(*names) ⇒ Object



10
11
12
# File 'lib/active_support/cache/redis_cluster_store.rb', line 10

def fetch_multi(*names)
  fail ::NotImplementedError, "The default implementation uses MULTI which isn't supported. This can be changed to use MSET and work."
end

#increment(key, amount = 1, options = {}) ⇒ Object



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

def increment(key, amount = 1, options = {})
  options = merged_options(options)
  ttl = _expires_in(options)
  normalized_key = normalize_key(key, options)
  instrument(:increment, key, :amount => amount) do
    redis.with do |c|
      if ttl
        new_value, _ = c.pipelined do
          c.incrby normalized_key, amount
          c.expire normalized_key, ttl
        end
        new_value
      else
        c.incrby normalized_key, amount
      end
    end
  end
end