Class: ActiveSupport::Cache::RedisClusterStore
- Inherits:
-
RedisCacheStore
- Object
- RedisCacheStore
- ActiveSupport::Cache::RedisClusterStore
- Defined in:
- lib/active_support/cache/redis_cluster_store.rb
Instance Method Summary collapse
- #delete_matched(matcher, options = nil) ⇒ Object
- #fetch_multi(*names) ⇒ Object
- #increment(key, amount = 1, options = {}) ⇒ Object
- #read_multi(*names) ⇒ Object
- #write_multi(hash, options = nil) ⇒ Object
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, = nil) fail ::NotImplementedError, "Deleting keys with a matcher is not supported with redis cluster" end |
#fetch_multi(*names) ⇒ Object
18 19 20 |
# File 'lib/active_support/cache/redis_cluster_store.rb', line 18 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
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/active_support/cache/redis_cluster_store.rb', line 22 def increment(key, amount = 1, = {}) = () ttl = _expires_in() normalized_key = normalize_key(key, ) 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 |
#read_multi(*names) ⇒ Object
10 11 12 |
# File 'lib/active_support/cache/redis_cluster_store.rb', line 10 def read_multi(*names) fail ::NotImplementedError, "Reading multiple keys with MGET is not supported with redis cluster because the keys may live on different shards" end |
#write_multi(hash, options = nil) ⇒ Object
14 15 16 |
# File 'lib/active_support/cache/redis_cluster_store.rb', line 14 def write_multi(hash, = nil) fail ::NotImplementedError, "Writing multiple keys with MSET is not supported with redis cluster because the keys may live on different shards" end |