pub struct CacheService { /* private fields */ }Expand description
A CacheService-backed Memcache implementation.
This is the stable application facade. Its production backend mirrors the
reference client master/master-L1/slave/slave-L1 topology over one persistent
brz-net session per physical node.
The backend lives behind an ArcSwapAny so it can be hot-swapped at
runtime. Construct via CacheService::new for a fixed (one-shot)
backend, or CacheService::new_live for a backend that hot-swaps when a
CacheServiceConfigSource pushes new configuration.
Implementations§
Source§impl CacheService
impl CacheService
Sourcepub async fn single(endpoint: impl Into<String>) -> Result<Self>
pub async fn single(endpoint: impl Into<String>) -> Result<Self>
Builds one unsharded master endpoint using CacheService defaults.
The resulting topology contains exactly one replica group, one shard, one physical node, and one persistent TCP connection.
Sourcepub async fn single_with_options(
endpoint: impl Into<String>,
options: CacheServiceOptions,
) -> Result<Self>
pub async fn single_with_options( endpoint: impl Into<String>, options: CacheServiceOptions, ) -> Result<Self>
Builds one unsharded master endpoint with explicit transport options.
Sourcepub async fn new(
conf: CacheNamespaceConf,
options: CacheServiceOptions,
) -> Result<Self>
pub async fn new( conf: CacheNamespaceConf, options: CacheServiceOptions, ) -> Result<Self>
Builds a cache from a fixed (one-shot) namespace configuration. The
backend never changes — use CacheService::new_live for a backend
that hot-swaps on config change.
Sourcepub async fn new_live(
source: Arc<dyn CacheServiceConfigSource>,
options: CacheServiceOptions,
) -> Result<Self>
pub async fn new_live( source: Arc<dyn CacheServiceConfigSource>, options: CacheServiceOptions, ) -> Result<Self>
Builds a cache whose backend hot-swaps when source pushes new
configuration. source drives the cache — CacheService itself never
polls. The initial configuration is loaded once at construction.
Use this with an application-owned CacheServiceConfigSource.
Trait Implementations§
Source§impl Clone for CacheService
impl Clone for CacheService
Source§impl Memcache for CacheService
impl Memcache for CacheService
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok(None).