Class: ActiveSupport::Cache::SmartRedisCache
- Inherits:
-
RedisCacheStore
- Object
- RedisCacheStore
- ActiveSupport::Cache::SmartRedisCache
- Defined in:
- lib/active_support/cache/smart_redis_cache.rb
Instance Method Summary collapse
-
#initialize(**args) ⇒ SmartRedisCache
constructor
known options: ActiveSupport::Cache - universal options :coder, :compresstrue, :compress_threshold1024, :compressorZlib, :expires_in0, :namespacenil, :race_condition_ttl0, :serializerMarshal, :skip_nilfalse, :rawfalse, :max_key_size250 ActiveSupport::Cache::Store pool: :size{5, :timeout5} ActiveSupport::Cache::RedisCacheStore :client, :error_handler RedisClient :url, :hostlocalhost, :port6379, :path :usernamenil, :passwordnil, :db0, :idnil :timeout1 (sets next 3 ->), :connect_timeout1, :read_timeout1, :write_timeout1 :idle_timeout30, :custom{} :sslfalse, ssl_params: :cert, :key, :verify_hostname :protocol2, :reconnect_attempts0, :middlewares[], :circuit_breakernil for sentinels or cluster, build directly and pass in as :client.
Constructor Details
#initialize(**args) ⇒ SmartRedisCache
known options:
ActiveSupport::Cache - universal options
:coder, :compress{true}, :compress_threshold{1024}, :compressor{Zlib},
:expires_in{0}, :namespace{nil}, :race_condition_ttl{0}, :serializer{Marshal},
:skip_nil{false}, :raw{false}, :max_key_size{250}
ActiveSupport::Cache::Store
pool: {:size{5}, :timeout{5}}
ActiveSupport::Cache::RedisCacheStore
:client, :error_handler
RedisClient
:url, :host{localhost}, :port{6379}, :path
:username{nil}, :password{nil}, :db{0}, :id{nil}
:timeout{1} (sets next 3 ->), :connect_timeout{1}, :read_timeout{1}, :write_timeout{1}
:idle_timeout{30}, :custom{{}}
:ssl{false}, ssl_params: {:ca_file, :cert, :key, :verify_hostname}
:protocol{2}, :reconnect_attempts{0}, :middlewares{[]}, :circuit_breaker{nil}
for sentinels or cluster, build directly and pass in as :client
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_support/cache/smart_redis_cache.rb', line 31 def initialize(**args) args.reverse_merge!( namespace: ENV['REDIS_NAMESPACE'], expires_in: 1.day, race_condition_ttl: 5.seconds, connect_timeout: 0.5, read_timeout: 1, write_timeout: 1, reconnect_attempts: [0.2], ) args[:pool] ||= {} args[:pool][:size] ||= Integer(ENV.fetch('RAILS_MAX_THREADS'){ 5 }) args[:url] ||= ENV['REDIS_URL'] unless args.key?(:client) || args.key?(:url) args[:url] = args[:url].split(',') if args[:url].is_a?(String) super(**args) end |