pub struct FilesystemBackend<K, V, M = ()>{ /* private fields */ }Expand description
Filesystem storage backend
Implementations§
Source§impl<K, V, M> FilesystemBackend<K, V, M>
impl<K, V, M> FilesystemBackend<K, V, M>
Sourcepub async fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
pub async fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
Create a new filesystem backend with the given base path
Sourcepub fn with_format(self, format: SerializationFormat) -> Self
pub fn with_format(self, format: SerializationFormat) -> Self
Set the serialization format
Trait Implementations§
Source§impl<K, V, M> StorageBackend for FilesystemBackend<K, V, M>where
K: Serialize + DeserializeOwned + Hash + Eq + Clone + Send + Sync + Display + 'static,
V: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
M: Serialize + DeserializeOwned + Clone + Send + Sync + EntryMetadata,
impl<K, V, M> StorageBackend for FilesystemBackend<K, V, M>where
K: Serialize + DeserializeOwned + Hash + Eq + Clone + Send + Sync + Display + 'static,
V: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
M: Serialize + DeserializeOwned + Clone + Send + Sync + EntryMetadata,
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 HashMap<K, Vec<CacheEntry<K, V, M>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 HashMap<K, Vec<CacheEntry<K, V, M>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save entries to storage
Source§fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Vec<CacheEntry<K, V, M>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Vec<CacheEntry<K, V, M>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load entries from storage
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove entries for a specific key
Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all entries from storage
Source§fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if storage contains a key
Auto Trait Implementations§
impl<K, V, M> Freeze for FilesystemBackend<K, V, M>
impl<K, V, M> RefUnwindSafe for FilesystemBackend<K, V, M>
impl<K, V, M> Send for FilesystemBackend<K, V, M>
impl<K, V, M> Sync for FilesystemBackend<K, V, M>
impl<K, V, M> Unpin for FilesystemBackend<K, V, M>
impl<K, V, M> UnsafeUnpin for FilesystemBackend<K, V, M>
impl<K, V, M> UnwindSafe for FilesystemBackend<K, V, M>
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