v7.0.0 - Show latest stable - 0 notes - Superclass: ActiveSupport::Cache::Store

Redis cache store.

Deployment note: Take care to use a *dedicated Redis cache* rather than pointing this at your existing Redis server. It won’t cope well with mixed usage patterns and it won’t expire cache entries by default.

Redis cache server setup guide: redis.io/topics/lru-cache

  • Supports vanilla Redis, hiredis, and Redis::Distributed.

  • Supports Memcached-like sharding across Redises with Redis::Distributed.

  • Fault tolerant. If the Redis server is unavailable, no exceptions are raised. Cache fetches are all misses and writes are dropped.

  • Local cache. Hot in-memory primary cache within block/middleware scope.

  • read_multi and write_multi support for Redis mget/mset. Use Redis::Distributed 4.0.1+ for distributed mget support.

  • delete_matched support for Redis KEYS globs.

Constants

SCAN_BATCH_SIZE = 1000

DEFAULT_ERROR_HANDLER = -> (method:, returning:, exception:) do if logger logger.error { "RedisCacheStore: #{method} failed, returned #{returning.inspect}: #{exception.class}: #{exception.message}" } end end

DEFAULT_REDIS_OPTIONS = { connect_timeout: 20, read_timeout: 1, write_timeout: 1, reconnect_attempts: 0, }

MAX_KEY_BYTESIZE = 1024

Attributes

[R] max_key_bytesize
[R] redis_options
Show files where this class is defined (1 file)
Register or log in to add new notes.