TECHNOLOGY

LiteLLM rebuilds in-memory cache expiry bookkeeping for repeatedly renewed keys

In this article
THE QUICK TAKE

Exercise renewal, replacement, expiry and extreme TTL inputs together when checking LiteLLM’s cache fix; live entry count alone cannot reveal stale expiry bookkeeping.

LiteLLM v1.111.0-dev.4 includes a Rust in-memory cache correction for expired keys and very long TTLs. The November 15 prerelease’s implementation replaces stale expiry bookkeeping with an exact index. Session pins and cooldowns that are repeatedly renewed make a more revealing acceptance workload than a cache filled once and left idle.

Renew the same key repeatedly

Create a bounded set of synthetic keys and repeatedly replace their values and expiry times. Measure memory over a sustained run while confirming the live-key population stays fixed. This targets stale deadline records rather than ordinary cache growth. A one-time capacity test can pass while renewal bookkeeping grows. Keep request rate and TTL schedule in the report so a memory trend has an interpretable cause.

Old deadlines must not erase new values

Renew a key just before its original deadline and verify that it remains readable until the new deadline. Delete and recreate another key with a distinct marker. Inspect values around both old and new boundaries. These cases check correctness as well as memory: a compact expiry index is useful only if removing an old deadline cannot remove the replacement entry or briefly break a routing pin.

Extreme TTLs must not disable the cache

Use the supported interface to supply an unusually large synthetic TTL, then perform ordinary reads and writes afterward. Assert that the worker remains usable and the cache continues returning known values. This checks the reported panic-and-lock failure shape without treating a successful extreme input as permission to retain data indefinitely. The application still needs an explicit, reasonable retention policy for each kind of cached state.

Keep multi-worker scope explicit

Repeat the workload per worker and observe whether routing behavior depends on local cache residence. The fix concerns the in-memory implementation, not a new distributed consistency guarantee. Compare correctness and memory under the same traffic pattern before evaluating total gateway capacity. An adoption report should distinguish stable expiry bookkeeping from the separate question of coordinating session state across several workers or replicas.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles