pub struct FileCache { /* private fields */ }Expand description
Persistent filesystem cache adapter.
Implementations§
Source§impl FileCache
impl FileCache
Sourcepub fn new(config: FileCacheConfig) -> Self
pub fn new(config: FileCacheConfig) -> Self
Create a filesystem cache adapter.
Sourcepub async fn cleanup_expired(&self, max_entries: usize) -> AppResult<usize>
pub async fn cleanup_expired(&self, max_entries: usize) -> AppResult<usize>
Remove expired cache entries, checking at most max_entries files.
Reads stay non-destructive to avoid unlinking a concurrent fresh write. Call this method from application-owned maintenance code when filesystem cache entries use TTLs and the cache directory needs bounded cleanup.
Trait Implementations§
Source§impl CacheStore for FileCache
impl CacheStore for FileCache
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = AppResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = AppResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a string value by key.
Source§fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
val: &'life2 str,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
val: &'life2 str,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a string value with an optional TTL. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for FileCache
impl !UnwindSafe for FileCache
impl Freeze for FileCache
impl Send for FileCache
impl Sync for FileCache
impl Unpin for FileCache
impl UnsafeUnpin for FileCache
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