pub fn build_backend(
config: &BackendConfig,
) -> BoxFuture<'_, Result<Arc<dyn StorageBackend>, CacheError>>Expand description
Config-select factory: build the concrete StorageBackend a
BackendConfig names.
This is typed dispatch, not stringly โ a new backend kind is a
non-exhaustive-match compile error, and the Tiered
arm recurses, composing each sub-backend into a TieredBackend. The result
is an Arc<dyn StorageBackend> that drops straight into
AppState.storage โ the server never changes shape whether the backend is one
tier or three.
The Redis and Pg arms require their production transports; without the
corresponding Cargo feature (redis-client / postgres) they return a typed
CacheError::NotImplemented rather than silently falling back to disk โ the
never-silent-hardcode rule.
Returns a boxed future because the Tiered arm is recursive.
ยงErrors
Propagates any backend construction failure, or CacheError::NotImplemented
when a config selects a backend whose feature is not compiled in.