pub struct ArticleCache { /* private fields */ }Expand description
Article cache using LRU eviction with TTL
Implementations§
Source§impl ArticleCache
impl ArticleCache
Sourcepub fn new(max_capacity: u64, ttl: Duration) -> Self
pub fn new(max_capacity: u64, ttl: Duration) -> Self
Create a new article cache
§Arguments
max_capacity- Maximum number of articles to cachettl- Time-to-live for cached articles
Sourcepub async fn get(&self, message_id: &str) -> Option<CachedArticle>
pub async fn get(&self, message_id: &str) -> Option<CachedArticle>
Get an article from the cache
Trait Implementations§
Source§impl Clone for ArticleCache
impl Clone for ArticleCache
Source§fn clone(&self) -> ArticleCache
fn clone(&self) -> ArticleCache
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 ArticleCache
impl !RefUnwindSafe for ArticleCache
impl Send for ArticleCache
impl Sync for ArticleCache
impl Unpin for ArticleCache
impl !UnwindSafe for ArticleCache
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