litellm/litellm/caching
Ishaan Jaff f724f3131d
(testing) add unit tests for LLMCachingHandler Class (#6279)
* add unit testing for test_async_set_cache

* test test_async_log_cache_hit_on_callbacks

* assert the correct response type is returned

* test_convert_cached_result_to_model_response

* unit testing for caching handler
2024-10-17 19:12:57 +05:30
..
__init__.py (testing) add unit tests for LLMCachingHandler Class (#6279) 2024-10-17 19:12:57 +05:30
base_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
caching.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
caching_handler.py (testing) add unit tests for LLMCachingHandler Class (#6279) 2024-10-17 19:12:57 +05:30
disk_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
dual_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
in_memory_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
qdrant_semantic_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
Readme.md (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
redis_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
redis_semantic_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30
s3_cache.py (refactor) - caching use separate files for each cache class (#6251) 2024-10-16 13:17:21 +05:30

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