pub struct DistributedCache { /* private fields */ }Expand description
Distributed cache manager.
Implementations§
Source§impl DistributedCache
impl DistributedCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new distributed cache.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn put(
&self,
key: CacheKey,
data: Vec<u8>,
worker_id: WorkerId,
) -> Result<()>
pub fn put( &self, key: CacheKey, data: Vec<u8>, worker_id: WorkerId, ) -> Result<()>
Put entry in cache.
Sourcepub fn remove(&self, key: &CacheKey, worker_id: WorkerId) -> Result<()>
pub fn remove(&self, key: &CacheKey, worker_id: WorkerId) -> Result<()>
Remove entry from cache.
Sourcepub fn invalidate(&self, key: CacheKey, version: u64) -> Result<Vec<WorkerId>>
pub fn invalidate(&self, key: CacheKey, version: u64) -> Result<Vec<WorkerId>>
Invalidate cache entry (coherency protocol).
Sourcepub fn get_locations(&self, key: &CacheKey) -> Vec<WorkerId>
pub fn get_locations(&self, key: &CacheKey) -> Vec<WorkerId>
Get cache entry locations.
Sourcepub fn warm_cache(
&self,
keys: Vec<CacheKey>,
worker_id: WorkerId,
) -> Result<usize>
pub fn warm_cache( &self, keys: Vec<CacheKey>, worker_id: WorkerId, ) -> Result<usize>
Warm cache with entries.
Sourcepub fn evict_expired(&self) -> usize
pub fn evict_expired(&self) -> usize
Evict expired entries.
Sourcepub fn get_statistics(&self) -> CacheStats
pub fn get_statistics(&self) -> CacheStats
Get cache statistics.
Trait Implementations§
Source§impl Clone for DistributedCache
impl Clone for DistributedCache
Source§fn clone(&self) -> DistributedCache
fn clone(&self) -> DistributedCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DistributedCache
impl !RefUnwindSafe for DistributedCache
impl Send for DistributedCache
impl Sync for DistributedCache
impl Unpin for DistributedCache
impl UnsafeUnpin for DistributedCache
impl !UnwindSafe for DistributedCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more