pub struct ResponseCache { /* private fields */ }Expand description
LRU cache for responses with TTL.
Implementations§
Source§impl ResponseCache
impl ResponseCache
Sourcepub fn with_settings(max_entries: usize, ttl: Duration) -> Self
pub fn with_settings(max_entries: usize, ttl: Duration) -> Self
Create with custom settings.
Sourcepub fn get(&self, key: &str) -> Option<ChainStepResult>
pub fn get(&self, key: &str) -> Option<ChainStepResult>
Get a cached entry if valid.
Sourcepub fn set(&self, key: &str, result: ChainStepResult)
pub fn set(&self, key: &str, result: ChainStepResult)
Set a cache entry.
Trait Implementations§
Source§impl Debug for ResponseCache
impl Debug for ResponseCache
Auto Trait Implementations§
impl Freeze for ResponseCache
impl !RefUnwindSafe for ResponseCache
impl Send for ResponseCache
impl Sync for ResponseCache
impl Unpin for ResponseCache
impl UnsafeUnpin for ResponseCache
impl UnwindSafe for ResponseCache
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