External Storage Backends#
LMCache supports integrating custom storage backends through dynamic loading. This allows extending cache storage capabilities without modifying core code.
Configuration#
Add the following to your lmcache.yaml
:
chunk_size: 64
local_cpu: False
max_local_cpu_size: 5
external_backends: "log_external_backend"
extra_config:
external_backend.log_external_backend.module_path: lmc_external_log_backend.lmc_external_log_backend
external_backend.log_external_backend.class_name: ExternalLogBackend
Implementation Example#
A sample backend implementation (e.g., https://github.com/opendataio/lmc_external_log_backend/ ):
Key Requirements#
Inherit from
StorageBackendInterface
Implement all abstract methods
Provide the constructor as this example
Package as installable Python module
Usage Notes#
Install your backend package in LMCache environment
Add
external_backends
configuration and its relatedmodule_path
andclass_name
toextra_config
sectionBackends are initialized during LMCache startup
Use
external_backends
list to enable specific backends
Note
Backends are loaded in order - earlier backends have higher priority during cache lookups.