pub struct FileStore { /* private fields */ }Expand description
A cache stored on disk. Cloning shares one directory and one lock table.
Implementations§
Trait Implementations§
Source§impl Cache for FileStore
impl Cache for FileStore
Source§fn driver(&self) -> &'static str
fn driver(&self) -> &'static str
The driver’s name, used in
cache.hit / cache.miss events and in
error messages. Telescope shows it as the store column.Source§fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<Option<Json>>>
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<Option<Json>>>
Fetch a value, or
None when it is missing or expired. Read moreSource§fn put<'a>(
&'a self,
key: &'a str,
value: Json,
ttl: Duration,
) -> BoxFuture<'a, Result<()>>
fn put<'a>( &'a self, key: &'a str, value: Json, ttl: Duration, ) -> BoxFuture<'a, Result<()>>
Store a value that expires after
ttl. Read moreSource§fn forever<'a>(&'a self, key: &'a str, value: Json) -> BoxFuture<'a, Result<()>>
fn forever<'a>(&'a self, key: &'a str, value: Json) -> BoxFuture<'a, Result<()>>
Store a value with no expiry. It still goes away on
Cache::flush.Source§fn forget<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<bool>>
fn forget<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<bool>>
Remove a key. Returns whether something was actually there.
Source§fn increment<'a>(&'a self, key: &'a str, by: i64) -> BoxFuture<'a, Result<i64>>
fn increment<'a>(&'a self, key: &'a str, by: i64) -> BoxFuture<'a, Result<i64>>
Add
by to a counter, creating it at zero first. Returns the new value. Read moreSource§fn increment_within<'a>(
&'a self,
key: &'a str,
by: i64,
ttl: Duration,
) -> BoxFuture<'a, Result<i64>>
fn increment_within<'a>( &'a self, key: &'a str, by: i64, ttl: Duration, ) -> BoxFuture<'a, Result<i64>>
Increment a counter, giving it
ttl only when this call created it. Read moreSource§fn ttl<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<Option<Duration>>>
fn ttl<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<Option<Duration>>>
How long until a key expires:
None when it is missing or immortal. Read moreSource§fn has<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<bool>>
fn has<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<bool>>
Whether a live (unexpired) value exists.
Auto Trait Implementations§
impl !RefUnwindSafe for FileStore
impl !UnwindSafe for FileStore
impl Freeze for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
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