class ActiveSupport::Cache::RedisClusterStore
Constants
- DEFAULT_IGNORED_COMMAND_ERRORS
Attributes
ignored_command_errors[R]
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/active_support/cache/redis_cluster_store.rb, line 11 def initialize(*) super @ignored_command_errors = ::Set.new(@options.fetch(:ignored_command_errors, DEFAULT_IGNORED_COMMAND_ERRORS)) end
Public Instance Methods
delete_entry(key, options)
click to toggle source
Calls superclass method
# File lib/active_support/cache/redis_cluster_store.rb, line 16 def delete_entry(key, options) super rescue Redis::CommandError => error raise unless ignored_command_errors.include?(error.message) raise if raise_errors? false end
delete_matched(matcher, options = nil)
click to toggle source
# File lib/active_support/cache/redis_cluster_store.rb, line 24 def delete_matched(matcher, options = nil) fail ::NotImplementedError, "Deleting keys with a matcher is not supported with redis cluster" end
fetch_multi(*names)
click to toggle source
# File lib/active_support/cache/redis_cluster_store.rb, line 28 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 = {})
click to toggle source
# File lib/active_support/cache/redis_cluster_store.rb, line 32 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 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_entry(key, options)
click to toggle source
Calls superclass method
# File lib/active_support/cache/redis_cluster_store.rb, line 51 def read_entry(key, options) super rescue Redis::CommandError => error raise unless ignored_command_errors.include?(error.message) raise if raise_errors? nil end
write_entry(key, entry, options)
click to toggle source
Calls superclass method
# File lib/active_support/cache/redis_cluster_store.rb, line 59 def write_entry(key, entry, options) super rescue Redis::CommandError => error raise unless ignored_command_errors.include?(error.message) raise if raise_errors? false end
Private Instance Methods
_expires_in(options)
click to toggle source
# File lib/active_support/cache/redis_cluster_store.rb, line 69 def _expires_in(options) if options # Rack::Session Merb Rails/Sinatra options[:expire_after] || options[:expires_in] || options[:expire_in] end end