MCPcopy Create free account
hub / github.com/BerriAI/litellm / routing_cache

Method routing_cache

litellm/router_python_host.py:147–153  ·  view source on GitHub ↗

The store a router keeps its routing state in (cooldowns, fail counts, usage): in memory, plus Redis when the router's arguments name one. The host builds and owns it; a Rust core reads and writes it through cache steps.

(self, config: RouterConfig)

Source from the content-addressed store, hash-verified

145 litellm.suppress_debug_info = True
146
147 def routing_cache(self, config: RouterConfig) -> "DualCache":
148 """The store a router keeps its routing state in (cooldowns, fail counts, usage): in memory,
149 plus Redis when the router's arguments name one. The host builds and owns it; a Rust core
150 reads and writes it through cache steps."""
151 from litellm.caching.caching import DualCache, InMemoryCache
152
153 return DualCache(redis_cache=redis_cache_for(config), in_memory_cache=InMemoryCache())
154
155 def router_usage(self, redis: "RedisStores") -> "RouterUsage":
156 """The per-minute tpm/rpm counters a router counts its deployments' calls in, on ``redis``."""

Callers

nothing calls this directly

Calls 3

DualCacheClass · 0.90
InMemoryCacheClass · 0.90
redis_cache_forFunction · 0.85

Tested by

no test coverage detected