Skip to main content

UnifiedCache

Trait UnifiedCache 

Source
pub trait UnifiedCache<K, V>:
    Send
    + Sync
    + Debug
where K: Clone + Hash + Eq + Send + Sync + Debug, V: Clone + Send + Sync + Debug,
{ // Required methods fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = Option<V>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn put<'life0, 'async_trait>( &'life0 self, key: K, value: V, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn remove<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn contains_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = UnifiedCacheStats> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn capacity<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cache_type(&self) -> &'static str; // Provided method fn is_empty<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } }
Expand description

Unified cache interface for all rez-core cache types

This trait provides a common interface for SolverCache, RepositoryCache, RexCache, and any future cache implementations. It enables unified management through the IntelligentCacheManager.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = Option<V>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a value from the cache

Returns Some(value) if the key exists and is valid, None if the key doesn’t exist or has expired.

Source

fn put<'life0, 'async_trait>( &'life0 self, key: K, value: V, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Put a value into the cache

Stores the key-value pair in the cache. May trigger eviction if the cache is at capacity.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a value from the cache

Returns true if the key was present and removed, false if the key was not found.

Source

fn contains_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a key exists in the cache

Returns true if the key exists and is valid, false otherwise.

Source

fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = UnifiedCacheStats> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cache statistics

Returns comprehensive statistics about cache performance, including hit rates, memory usage, and entry counts.

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clear all entries from the cache

Removes all cached entries. This operation cannot be undone.

Source

fn size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current number of entries in the cache

Source

fn capacity<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cache capacity (maximum number of entries)

Source

fn cache_type(&self) -> &'static str

Get cache type identifier

Provided Methods§

Source

fn is_empty<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the cache is empty

Implementors§

Source§

impl<K, V> UnifiedCache<K, V> for IntelligentCacheManager<K, V>
where K: Clone + Hash + Eq + Send + Sync + Debug + 'static, V: Clone + Send + Sync + Debug + 'static,