pub struct MemoryCache { /* private fields */ }Expand description
Thread-safe in-memory RDAP response cache.
Cache keys are the full query URL strings.
Implementations§
Source§impl MemoryCache
impl MemoryCache
Sourcepub fn with_config(config: CacheConfig) -> Self
pub fn with_config(config: CacheConfig) -> Self
Creates a cache with custom configuration.
Sourcepub fn get(&self, key: &str) -> Option<Value>
pub fn get(&self, key: &str) -> Option<Value>
Retrieves a cached value if it exists and has not expired.
Sourcepub fn set_with_ttl(&self, key: String, value: Value, ttl: Duration)
pub fn set_with_ttl(&self, key: String, value: Value, ttl: Duration)
Inserts a value with a custom TTL.
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Removes all expired entries.
Trait Implementations§
Source§impl Clone for MemoryCache
impl Clone for MemoryCache
Source§fn clone(&self) -> MemoryCache
fn clone(&self) -> MemoryCache
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 moreSource§impl Debug for MemoryCache
impl Debug for MemoryCache
Auto Trait Implementations§
impl Freeze for MemoryCache
impl !RefUnwindSafe for MemoryCache
impl Send for MemoryCache
impl Sync for MemoryCache
impl Unpin for MemoryCache
impl UnsafeUnpin for MemoryCache
impl !UnwindSafe for MemoryCache
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