pub trait Caching: Clone {
// Required methods
fn mode(&self) -> &CacheMode;
fn modes() -> [CacheMode; 2];
fn is_empty(&self) -> bool;
fn exists(&self, bookmark: &TargetBookmark) -> bool;
fn open(
&self,
bookmark: &TargetBookmark
) -> Result<Option<impl Read>, BogrepError>;
fn get(
&self,
bookmark: &TargetBookmark
) -> Result<Option<String>, BogrepError>;
fn add<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn replace<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_all<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmarks: &'life1 mut TargetBookmarks
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear(&self, bookmarks: &mut TargetBookmarks) -> Result<(), BogrepError>;
}Expand description
A trait to manage the cache in a file system or a mock cache used in testing.
Required Methods§
fn mode(&self) -> &CacheMode
fn modes() -> [CacheMode; 2]
fn is_empty(&self) -> bool
sourcefn exists(&self, bookmark: &TargetBookmark) -> bool
fn exists(&self, bookmark: &TargetBookmark) -> bool
Check if content of bookmark exists in cache.
sourcefn open(
&self,
bookmark: &TargetBookmark
) -> Result<Option<impl Read>, BogrepError>
fn open( &self, bookmark: &TargetBookmark ) -> Result<Option<impl Read>, BogrepError>
Open the cached file for a bookmark.
sourcefn get(&self, bookmark: &TargetBookmark) -> Result<Option<String>, BogrepError>
fn get(&self, bookmark: &TargetBookmark) -> Result<Option<String>, BogrepError>
Get the content of a bookmark from cache.
sourcefn add<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add the content of a bookmark to cache.
sourcefn replace<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace<'life0, 'life1, 'async_trait>(
&'life0 self,
html: String,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replace the content of a bookmark in cache.
sourcefn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmark: &'life1 mut TargetBookmark
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the content of a bookmark from cache.
sourcefn remove_all<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmarks: &'life1 mut TargetBookmarks
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_all<'life0, 'life1, 'async_trait>(
&'life0 self,
bookmarks: &'life1 mut TargetBookmarks
) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the content of multiple bookmarks from cache.
sourcefn clear(&self, bookmarks: &mut TargetBookmarks) -> Result<(), BogrepError>
fn clear(&self, bookmarks: &mut TargetBookmarks) -> Result<(), BogrepError>
Clear the cache, i.e. remove all files in the cache directory.
Object Safety§
This trait is not object safe.