Redis-backed distributed cache implementation.
Features:
Suitable for:
Redis Data Structures Used:
Redis-backed distributed cache implementation. Features: - Distributed caching across multiple processes - Automatic TTL and expiration - Atomic operations (INCR, DECR, SETNX) - Pattern matching with SCAN - Namespace support - Connection pooling Suitable for: - Production deployments - Distributed systems - High-availability applications - Microservices architecture Redis Data Structures Used: - Strings: For cache values (Nippy serialized, stored as binary) - TTL: Built-in Redis expiration - Atomic ops: INCR, DECR, SETNX, etc.
(close-redis-pool! pool)Close Redis connection pool.
Args: pool - JedisPool instance
Close Redis connection pool. Args: pool - JedisPool instance
(configured-password config)The Redis password to authenticate with, or nil for none.
Blank is not a password. #env REDIS_PASSWORD yields "" for a variable
that is set but empty — which is what a Kubernetes Secret with an empty value
and a compose file with a placeholder both produce — and "" is truthy, so
the pool authenticated against a Redis that has no password. Jedis then fails
with an AUTH error naming Redis, sending whoever reads it to look at the
server rather than at the variable.
The Redis password to authenticate with, or nil for none. Blank is not a password. `#env REDIS_PASSWORD` yields "" for a variable that is set but empty — which is what a Kubernetes Secret with an empty value and a compose file with a placeholder both produce — and `""` is truthy, so the pool authenticated against a Redis that has no password. Jedis then fails with an AUTH error naming Redis, sending whoever reads it to look at the server rather than at the variable.
(create-redis-cache pool)(create-redis-cache pool config)Create Redis cache instance.
Args: pool - JedisPool instance config - Optional configuration map: :default-ttl - Default TTL in seconds :prefix - Key prefix for all operations
Returns: RedisCache instance implementing all cache protocols
Create Redis cache instance.
Args:
pool - JedisPool instance
config - Optional configuration map:
:default-ttl - Default TTL in seconds
:prefix - Key prefix for all operations
Returns:
RedisCache instance implementing all cache protocols(create-redis-pool config)Create a Jedis connection pool.
Args: config - Configuration map: :host - Redis host (default: localhost) :port - Redis port (default: 6379) :password - Redis password (optional) :database - Redis database number (default: 0) :timeout - Connection timeout in ms (default: 2000) :max-total - Max connections (default: 20) :max-idle - Max idle connections (default: 10) :min-idle - Min idle connections (default: 2)
Returns: JedisPool instance
Create a Jedis connection pool.
Args:
config - Configuration map:
:host - Redis host (default: localhost)
:port - Redis port (default: 6379)
:password - Redis password (optional)
:database - Redis database number (default: 0)
:timeout - Connection timeout in ms (default: 2000)
:max-total - Max connections (default: 20)
:max-idle - Max idle connections (default: 10)
:min-idle - Min idle connections (default: 2)
Returns:
JedisPool instancecljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |