pub struct Cache { /* private fields */ }Implementations§
Source§impl Cache
impl Cache
pub fn new() -> Result<Self>
Sourcepub fn save_feed(&self, feed_url: &str, stories: &[NewsStory]) -> Result<()>
pub fn save_feed(&self, feed_url: &str, stories: &[NewsStory]) -> Result<()>
Save feed to cache
Sourcepub fn load_feed(&self, feed_url: &str) -> Option<Vec<NewsStory>>
pub fn load_feed(&self, feed_url: &str) -> Option<Vec<NewsStory>>
Load feed from cache if not expired
Sourcepub fn load_feed_offline(&self, feed_url: &str) -> Option<Vec<NewsStory>>
pub fn load_feed_offline(&self, feed_url: &str) -> Option<Vec<NewsStory>>
Load feed from cache regardless of expiry (for offline mode)
Sourcepub fn save_article(&self, article_url: &str, content: &str) -> Result<()>
pub fn save_article(&self, article_url: &str, content: &str) -> Result<()>
Save article content to cache
Sourcepub fn load_article(&self, article_url: &str) -> Option<String>
pub fn load_article(&self, article_url: &str) -> Option<String>
Load article from cache if not expired
Sourcepub fn load_article_offline(&self, article_url: &str) -> Option<String>
pub fn load_article_offline(&self, article_url: &str) -> Option<String>
Load article from cache regardless of expiry (for offline mode)
Sourcepub fn get_feed_age(&self, feed_url: &str) -> Option<u64>
pub fn get_feed_age(&self, feed_url: &str) -> Option<u64>
Get cache age in seconds for a feed
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more