Skip to content

Redis caches

CacheRedis stores the latest state of entities. It is a cache, not a historical table. Configure the Redis connection privately; this guide contains no cluster topology or addresses.

Client sharing and concurrency

Caches share a client within a process; asynchronous clients are shared per event loop. SHAREDDATA_CACHE_REDIS_CONCURRENCY bounds requests in flight across the loop's caches. Its default is 128 and accepted values are 1 through 1024. The connection capacity supports the chosen concurrency limit. Cluster initialization occurs before concurrent batches.

Batches read existing values with MGET and distribute entity writes across a bounded set of writers. The call returns after its writes are answered. Existing keys and the compare-and-set write semantics remain compatible across these clients.

Lifecycle

CacheRedis.aclose() does not close a client shared by other caches. Use aclose_shared() at the end of the owning loop's lifecycle.

Capacity planning

Measure throughput and connections against a disposable cluster matching your workload. Record client/server versions, batch sizes, payload sizes, concurrency and network latency. Values measured on one installation are not a universal performance guarantee. A larger concurrency limit can consume more connections without improving throughput.