litellm/litellm/caching
milan 15c7d850e5 fix(caching): stamp provider on embedding cache-hit logs so spend logs record provider
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-30 22:11:01 +00:00
..
__init__.py Add GCS bucket caching support (#13122) 2025-08-04 16:09:33 -07:00
_embedding_router.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
_internal_lru_cache.py (litellm SDK perf improvements) - handle cases when unable to lookup model in model cost map (#7750) 2025-01-13 19:58:46 -08:00
azure_blob_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
base_cache.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
caching.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
caching_handler.py fix(caching): stamp provider on embedding cache-hit logs so spend logs record provider 2026-07-30 22:11:01 +00:00
disk_cache.py fix(cache): make in-memory and disk cache increments atomic (#34013) 2026-07-20 15:51:01 -07:00
dual_cache.py fix(proxy): stop stale auth cache re-publish so key updates and deletes propagate across replicas (#33565) 2026-07-16 15:00:33 -07:00
gcs_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
in_memory_cache.py fix(cache): make in-memory and disk cache increments atomic (#34013) 2026-07-20 15:51:01 -07:00
llm_caching_handler.py fix: don't close HTTP/SDK clients on LLMClientCache eviction (#22925) 2026-03-05 12:00:38 -08:00
qdrant_semantic_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
Readme.md add azure blob cache support (#12587) 2025-07-15 11:47:38 -07:00
redis_cache.py fix(redis): stop an unreachable Redis from blocking every request (#35273) 2026-07-30 14:36:28 -07:00
redis_cluster_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
redis_semantic_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
s3_cache.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
valkey_semantic_cache.py fix(caching): pass only metadata to valkey semantic async embedding (#32295) 2026-07-07 08:52:03 +03:00

Caching on LiteLLM

LiteLLM supports multiple caching mechanisms. This allows users to choose the most suitable caching solution for their use case.

The following caching mechanisms are supported:

  1. RedisCache
  2. RedisSemanticCache
  3. QdrantSemanticCache
  4. InMemoryCache
  5. DiskCache
  6. S3Cache
  7. AzureBlobCache
  8. DualCache (updates both Redis and an in-memory cache simultaneously)

Folder Structure

litellm/caching/
├── base_cache.py
├── caching.py
├── caching_handler.py
├── disk_cache.py
├── dual_cache.py
├── in_memory_cache.py
├── qdrant_semantic_cache.py
├── redis_cache.py
├── redis_semantic_cache.py
├── s3_cache.py

Documentation