How lmcache/lmcache works
LMCache is a KV-cache management layer for LLM inference: serving engines hand cache data to LMCache, which can look up, reuse, and offload it across memory tiers and remote stores. Engine integrations and GPU/layout handling connect serving-engine cache formats to the cache runtime; distributed storage adds L1/L2 management, transfer, and coordination. Other major capabilities include non-prefix CacheBlend reuse, pluggable serialization, and observability. The README documents these product branches; sampled source is partial, so links between unsampled subsystems are shown only where supported.
Main entry points: cache_engine.py Cache engine · distributed/storage_manager.py Tier manager · integration Engine adapters · storage_backend/storage_manager.py Storage manager
Components 21
Engine integration
- Engine adapters
lmcache/integration - vLLM factory
lmcache/integration/vllm/vllm_service_factory.py - GPU connectors
lmcache/v1/gpu_connector - KV layouts
lmcache/v1/gpu_connector/kv_format
Cache runtime
- Cache engine
lmcache/v1/cache_engine.py - Storage manager
lmcache/v1/storage_backend/storage_manager.py - Serialization
lmcache/v1/distributed/serde
Distributed storage
- L1 memory
lmcache/v1/distributed/l1_manager.py - L2 adapters
lmcache/v1/distributed/l2_adapters - Tier manager
lmcache/v1/distributed/storage_manager.py - Storage controllers
lmcache/v1/distributed/storage_controllers - Transfer channels
lmcache/v1/distributed/transfer_channel - MP coordinator
lmcache/v1/mp_coordinator
Reuse and transform
- Lookup clients
lmcache/v1/lookup_client - CacheBlend
lmcache/v1/compute/blend - Attention reuse
lmcache/v1/compute/attention
Operations
- Management APIs
lmcache/v1/internal_api_server - Observability
lmcache/v1/mp_observability - CLI
lmcache/cli
Other components
- Serving engine
- Remote stores
Connections 19
- Serving engine → Engine adapters: integrates
- vLLM factory → Cache engine: creates
- Engine adapters → KV layouts: detects layouts
- Engine adapters → GPU connectors: connects tensors
- Cache engine → Storage manager: stores and loads
- Storage manager → Tier manager: uses tiers
- Tier manager → L1 memory: manages memory
- Tier manager → L2 adapters: manages adapters
- Tier manager → Storage controllers: starts controllers
- L2 adapters → Remote stores: offloads cache
- Tier manager → Transfer channels: transfers cache
- Serialization → L2 adapters: transforms data
- MP coordinator → Lookup clients: coordinates lookup
- Lookup clients → Storage manager: checks cache
- CacheBlend → Cache engine: enables non-prefix reuse
- Attention reuse → Cache engine: reuses cached KV
- Management APIs → Cache engine: manages runtime
- Observability → Cache engine: monitors cache
- CLI → MP coordinator: queries service