pub struct ConcurrentCache { /* private fields */ }Expand description
Concurrent cache using DashMap for high-throughput scenarios
Implementations§
Source§impl ConcurrentCache
impl ConcurrentCache
Sourcepub fn new(capacity: usize, metrics: Arc<DataMatchingMetrics>) -> Self
pub fn new(capacity: usize, metrics: Arc<DataMatchingMetrics>) -> Self
Create a new concurrent cache
Sourcepub fn with_negative_ttl(self, ttl: Duration) -> Self
pub fn with_negative_ttl(self, ttl: Duration) -> Self
Set negative cache TTL
Sourcepub fn get(&self, key: &str) -> CacheResult
pub fn get(&self, key: &str) -> CacheResult
Get from cache (checks negative cache too)
Sourcepub fn insert(&self, key: String, data: DataSource)
pub fn insert(&self, key: String, data: DataSource)
Insert into cache
Sourcepub fn insert_negative(&self, key: String)
pub fn insert_negative(&self, key: String)
Insert a negative cache entry
Sourcepub fn negative_len(&self) -> usize
pub fn negative_len(&self) -> usize
Get negative cache size
Auto Trait Implementations§
impl Freeze for ConcurrentCache
impl !RefUnwindSafe for ConcurrentCache
impl Send for ConcurrentCache
impl Sync for ConcurrentCache
impl Unpin for ConcurrentCache
impl UnsafeUnpin for ConcurrentCache
impl UnwindSafe for ConcurrentCache
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