lmcache
A LLM serving engine extension to reduce TTFT and increase throughput, especially under long-context scenarios.
What it is and what it does
LMCache decouples KV cache management from inference engines, storing transformer caches persistently across GPU, CPU, and remote storage tiers. It enables reuse of cached key-value blocks across requests and sessions, reducing redundant prefill computation for multi-turn conversations, agentic workloads, and retrieval-augmented generation (RAG). The layer runs as a standalone daemon, survives engine restarts, and provides observability through Kubernetes metrics, cache hit rates, and token-level diagnostics.
The package integrates with mainstream open-source serving engines and supports pluggable storage backends (CPU RAM, local SSD, Redis, S3-compatible systems, and others) and transport layers (NVLink, RDMA, TCP). It includes non-prefix KV reuse via CacheBlend for selective recomputation, prefill-decode disaggregation, and a flexible serialization interface for compression and token dropping. Vendor neutrality means you can switch storage or serving engines without losing cached KV data.
Use it for:
- Multi-turn conversational AI: cache KV blocks from earlier turns to skip prefill recomputation on follow-up messages.
- RAG and knowledge-augmented generation: reuse cached context embeddings across queries with the same knowledge base.
- Agentic workloads: share KV caches across multiple reasoning steps and tool calls within a single session.
- Long-context inference: offload KV caches to CPU or remote storage when GPU memory is exhausted, enabling longer prompts.
- Batch serving with cache sharing: reduce total prefill cost across requests that share common prompt prefixes.
- Cross-engine failover: persist KV caches so inference can resume on a different serving engine without recomputation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LMCache is a KV cache management layer that stores, reuses, and monitors transformer key-value caches across LLM inference requests, reducing time-to-first-token and improving throughput for long-context workloads.
Yes, with conditions. Install if you run LLM inference at scale with multi-turn, RAG, or long-context workloads and want to reduce latency and cost. Active maintenance, permissive license, and strong community adoption are positive signals. Medium install friction (37 dependencies, Linux-only wheels) and alpha status mean you should test integration with your serving engine and storage backend before production deployment. No known vulnerabilities.
Install
lmcache on PyPI
pip
pip install lmcacheuv
uv add lmcachepoetry
poetry add lmcacheInstalling lmcache
Before you install
Medium install friction: 37 runtime dependencies including torch, numpy, fastapi, redis, and observability libraries (opentelemetry, prometheus). Wheels available for Python 3.10–3.13 on Linux x86_64. Active maintenance with recent release (9 days old) and strong community signal.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must retain license and copyright notices in distributions.
Quickstart
pip install lmcache
from lmcache import LMCache
# Initialize cache manager
cache = LMCache()
Requires Linux x86_64, Python 3.10–3.13, and torch; GPU recommended for typical LLM inference workloads.
Verify before relying
- Specific integration steps with mainstream serving engines beyond the high-level architecture.
- Performance gains (TTFT reduction, throughput improvement) quantified for representative workloads.
- Compatibility and tested versions for each supported storage backend (Redis, S3, local disk, etc.).
- Overhead of the daemon process and observability stack on latency-sensitive inference.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<3.14,>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 37 — aiofile, aiofiles, blake3, aiohttp, awscrt, cryptography, cufile-python, fastapi, httpx, huggingface_hub, msgspec, numpy, numba, nvtx, opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp, opentelemetry-exporter-prometheus, prometheus_client, psutil, py-cpuinfo, pytest, pyyaml, pyzmq, redis, safetensors, setuptools, setuptools_scm, sortedcontainers, torch |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 83,225/month — #14,090 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lmcache-0.5.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; lmcache-0.5.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; lmcache-0.5.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; lmcache-0.5.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
mooncake-transfer-engineMooncake Transfer Engine provides…
permissive · top 15,000 on PyPI
mooncake-transfer-engine-cuda13Mooncake Transfer Engine provides…
permissive · top 15,000 on PyPI
vllmvLLM is a high-throughput inference and serving…
permissive · top 5,000 on PyPI
memcache-hybridProvides Python bindings for a high-performance…
unclear · top 15,000 on PyPI
vllm-tpuvllm-tpu is a high-throughput LLM inference and…
permissive · top 15,000 on PyPI
gptcacheGPTCache provides semantic caching for LLM API…
permissive · top 15,000 on PyPI
vllm-cpuvllm-cpu provides CPU-optimized inference for…
permissive · top 15,000 on PyPI
ipex-llmAccelerates large language model inference on…
permissive · top 15,000 on PyPI
llmcompressorllmcompressor optimizes large language models…
permissive · top 15,000 on PyPI
vllm-routerRoutes and load-balances requests across vLLM…
permissive · top 15,000 on PyPI