vllm.v1.kv_offload.cpu.policies.factory
¶
Classes:
-
CachePolicyFactory–Registry for CachePolicy implementations, resolved by name.
CachePolicyFactory
¶
Registry for CachePolicy implementations, resolved by name.
Mirrors OffloadingSpecFactory (vllm/v1/kv_offload/factory.py): built-in policies are pre-registered below. External policies can either register_cache_policy() a friendly short name up front, or skip registration entirely and pass a module path at lookup time (out-of-tree, no vLLM fork/patch required) -- see get_cache_policy_cls.
Methods:
-
get_cache_policy_cls–Get a cache policy class by name.
-
register_cache_policy–Register a cache policy with a lazy-loading module and class name.
get_cache_policy_cls(name, module_path=None)
classmethod
¶
Get a cache policy class by name.
Parameters:
-
(name¶str) –Name of the cache policy. Checked against the registry first; if it's not registered and
module_pathis given,nameis imported from there instead -- an out-of-tree policy needs no register_cache_policy() call at all, just this module path passed through config (mirrors OffloadingSpecFactory.get_spec_cls's spec_module_path fallback). -
(module_path¶str | None, default:None) –Python import path to load
namefrom when it is not a registered policy.
Returns:
-
type[CachePolicy]–The cache policy class.
Raises ValueError if the cache policy is neither registered nor
resolvable via module_path.
register_cache_policy(name, module_path, class_name)
classmethod
¶
Register a cache policy with a lazy-loading module and class name.