pub fn register_backend(kind: &str, build: BackendBuildFn) -> Result<()>Expand description
Register a constructor for a cache backend under kind.
Returns Err if a non-built-in kind is already registered. Built-in
backends may be replaced so callers can mask a built-in implementation
(for example, a patched "moka" backend) without changing URI/config
strings elsewhere.
Typical usage from a backend crate:
fn build_my_backend(_config: &BackendConfig) -> Result<Arc<dyn CacheBackend>> {
Ok(Arc::new(MokaCacheBackend::with_capacity(1024)))
}
register_backend("my-backend", build_my_backend)?;