pub trait CacheDriver:
Any
+ Send
+ Sync
+ 'static {
// Required methods
fn driver_name(&self) -> &'static str;
fn create_store(
self: Arc<Self>,
store_name: &str,
config: &CacheStoreConfig,
) -> Result<Arc<dyn CacheStore>>;
// Provided methods
fn create_reload_store(
self: Arc<Self>,
store_name: &str,
config: &CacheStoreConfig,
) -> Result<Arc<dyn CacheStore>> { ... }
fn finish_store(
&self,
_store: &Arc<dyn CacheStore>,
_stores: &dyn CacheStoreResolver,
) -> Result<()> { ... }
}Expand description
Build-time factory for one cache backend family.
Third-party drivers register this trait with
CacheRegistry. They may deserialize the common
cache.yaml store options, ignore them, or use configuration owned by their
own provider.
Required Methods§
fn driver_name(&self) -> &'static str
fn create_store( self: Arc<Self>, store_name: &str, config: &CacheStoreConfig, ) -> Result<Arc<dyn CacheStore>>
Provided Methods§
Sourcefn create_reload_store(
self: Arc<Self>,
store_name: &str,
config: &CacheStoreConfig,
) -> Result<Arc<dyn CacheStore>>
fn create_reload_store( self: Arc<Self>, store_name: &str, config: &CacheStoreConfig, ) -> Result<Arc<dyn CacheStore>>
Build a store for a reload candidate.
Most drivers use ordinary construction. Drivers backed by a process-lifetime service may reject a first runtime registration or reuse a logical store already owned by that service.
Sourcefn finish_store(
&self,
_store: &Arc<dyn CacheStore>,
_stores: &dyn CacheStoreResolver,
) -> Result<()>
fn finish_store( &self, _store: &Arc<dyn CacheStore>, _stores: &dyn CacheStoreResolver, ) -> Result<()>
Complete links that require all named stores to exist.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".