litellm/tests/test_litellm/caching
ryan-crabbe-berri 7ba47a5b6e fix(budgets): page end-user cache invalidation after a budget reset
The budget-tier reset read every customer linked to an expiring tier into
one result set before the write, then invalidated their caches one key at
a time. Both of those scale with the customer count, so a large enough
deployment can OOM the proxy pod on the read, and the tail of the
population sits on a stale spend counter while the per-key invalidations
drain

PR #40639 moved the reset write itself to a link-based UPDATE, so that
pre-commit read no longer feeds the write. It only fed cache invalidation
and the service-logging counts, which means it can move after the commit.
This replaces it with a keyset walk over litellm_endusertable ordered by
user_id, taking RESET_BUDGET_JOB_BATCH_SIZE rows per page, the same shape
_reset_windows_for_source already uses, with no per-run page cap for the
same reason that walk has none: the cursor cannot survive the run, so a
cap would restart at the first customer on every tick and never reach the
tail

Each page's counter and cache keys now go out as one batched delete
through a new DualCache.async_delete_cache_keys, which drops the
in-memory entries and chunks the Redis DELETE at
DEFAULT_MAX_REDIS_BATCH_CACHE_SIZE

num_endusers_found and num_endusers_updated now report the customers
whose caches were invalidated after the commit rather than the rows read
before it, so both read 0 when the cascade write fails
2026-09-16 12:12:18 -07:00
..
test_azure_blob_cache.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_caching.py fix(caching): keep generic add_cache failures at ERROR unless the backend is Redis 2026-09-14 19:59:10 +00:00
test_caching_handler.py fix(caching): replay agentic loop follow-up cache hits as plain objects 2026-09-15 08:35:13 +00:00
test_check_and_fix_namespace_none_guard.py chore: litellm oss staging160626 (#30527) 2026-06-16 18:23:13 -07:00
test_disk_cache.py fix(cache): make in-memory and disk cache increments atomic (#34013) 2026-07-20 15:51:01 -07:00
test_dual_cache.py fix(budgets): page end-user cache invalidation after a budget reset 2026-09-16 12:12:18 -07:00
test_embedding_router.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_evicted_client_closer.py test(caching): align closer tests with self-healing handlers 2026-08-04 18:23:06 -07:00
test_gcs_cache.py fix: resolve Python 3.14 OCR annotations and remaining matrix failures 2026-09-02 14:35:38 -07:00
test_in_memory_cache.py refactor(mcp): reuse in-memory discovery storage 2026-09-11 17:53:51 -07:00
test_llm_caching_handler.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_llm_client_cache_e2e.py fix: don't close HTTP/SDK clients on LLMClientCache eviction (#22925) 2026-03-05 12:00:38 -08:00
test_qdrant_semantic_cache.py fix(proxy): run the remaining inline token counts off the event loop 2026-09-08 18:42:38 +00:00
test_redis_cache.py fix(redis): route the per-TTL pipeline write timeout log through the shared throttle 2026-09-14 19:38:14 +00:00
test_redis_cluster_cache.py fix: resolve Python 3.14 OCR annotations and remaining matrix failures 2026-09-02 14:35:38 -07:00
test_redis_cluster_node_isolation.py fix(caching): keep a node timeout from forcing a cluster-wide topology reinit on redis-py 8.x (#39349) 2026-09-03 17:31:58 -07:00
test_redis_connection_pool.py fix: resolve Python 3.14 OCR annotations and remaining matrix failures 2026-09-02 14:35:38 -07:00
test_redis_semantic_cache.py Merge pull request #40262 from BerriAI/litellm_lit_7190_inline_token_counts 2026-09-15 13:38:00 -07:00
test_s3_cache.py fix: address cross-version CI failures 2026-09-02 14:17:19 -07:00
test_valkey_semantic_cache.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00