litellm-mirror/litellm/caching
2025-03-24 19:52:45 -07:00
..
__init__.py (Redis Cluster) - Fixes for using redis cluster + pipeline (#8442) 2025-02-12 18:01:32 -08: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
base_cache.py LiteLLM Minor Fixes & Improvements (11/12/2024) (#6705) 2024-11-12 22:50:51 +05:30
caching.py refactor: complete migration 2025-03-24 19:52:45 -07:00
caching_handler.py fix(streaming_handler.py): support logging complete streaming response on cache hit 2025-03-17 18:10:39 -07:00
disk_cache.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
dual_cache.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
in_memory_cache.py refactor: complete migration 2025-03-24 19:52:45 -07:00
llm_caching_handler.py fix(llm_caching_handler.py): handle no current event loop error 2025-03-12 12:29:25 -07:00
qdrant_semantic_cache.py refactor: complete migration 2025-03-24 19:52:45 -07:00
Readme.md (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
redis_cache.py fix(redis_cache.py): add 5s default timeout 2025-03-17 14:27:36 -07:00
redis_cluster_cache.py (Redis fix) - use mget_non_atomic (#8682) 2025-02-20 17:51:31 -08:00
redis_semantic_cache.py update redisvl dependency 2025-03-24 08:42:11 -04:00
s3_cache.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08: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. 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