mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
With enable_redis_auth_cache on, everything user_api_key_cache keeps (user-key objects under bare hashed tokens, team/user/alias/org/end-user/project and the other management objects, the global proxy spend scalar) now lives in litellm-redis-store's auth_cache module: both memory partitions plus Redis, behind litellm/redis/stores/auth_cache.py. redis-py never reads or writes the keyspace and UserApiKeyCache.redis_cache stays None; features that only borrow the connection (MCP refresh lock, user provider credential cache) get it from redis_connection. With the flag off the cache stays Python memory as before. Values cross pyo3 as plain data and are written as main's json.dumps (str() for the sync set_cache path), read back with json.loads then literal_eval, with main's TTL rules, pinned by matching inline cases in the Rust and Python tests. The identity and owner prefetches read on the request's native pre-call batch and arm the cooldown read right before, so both leave in one pipeline; write-backs and pre-call SET/DEL ride the same batch. The invalidation publisher and subscriber stay in Python and forward evictions to the native memory tier. The auth cache sends the commands UserApiKeyCache does. Prefetch reads are one MGET, set_many writes the key-object partition and then the rest as two pipelines, delete runs both partitions as concurrent multi-key DELs in chunks of 1000, and increment_if_present is a plain EVAL with the amount written the way redis-py encodes it. |
||
|---|---|---|
| .. | ||
| stores | ||
| __init__.py | ||