pub struct DatabaseCache { /* private fields */ }Expand description
A database-backed cache backend storing entries in djangors_cache_entries.
Implementations§
Trait Implementations§
Source§impl Cache for DatabaseCache
impl Cache for DatabaseCache
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CacheError>> + 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 = Result<Option<Vec<u8>>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the raw byte value associated with
key if present and unexpired.Source§fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores
value under key with an optional time-to-live (ttl).Source§impl Clone for DatabaseCache
impl Clone for DatabaseCache
Source§fn clone(&self) -> DatabaseCache
fn clone(&self) -> DatabaseCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DatabaseCache
impl !UnwindSafe for DatabaseCache
impl Freeze for DatabaseCache
impl Send for DatabaseCache
impl Sync for DatabaseCache
impl Unpin for DatabaseCache
impl UnsafeUnpin for DatabaseCache
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> CacheExt for T
impl<T> CacheExt for T
Source§fn get_or_set<'life0, 'life1, 'async_trait, F, Fut>(
&'life0 self,
key: &'life1 str,
ttl: Option<Duration>,
f: F,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CacheError>> + Send + 'async_trait>>
fn get_or_set<'life0, 'life1, 'async_trait, F, Fut>( &'life0 self, key: &'life1 str, ttl: Option<Duration>, f: F, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CacheError>> + Send + 'async_trait>>
Retrieves
key if cached; otherwise executes f, caches the result under key, and returns it.Source§fn get_or_set_json<'life0, 'life1, 'async_trait, T, F, Fut>(
&'life0 self,
key: &'life1 str,
ttl: Option<Duration>,
f: F,
) -> Pin<Box<dyn Future<Output = Result<T, CacheError>> + Send + 'async_trait>>where
T: Serialize + DeserializeOwned + Send + 'async_trait,
F: FnOnce() -> Fut + Send + 'async_trait,
Fut: Future<Output = Result<T, CacheError>> + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_or_set_json<'life0, 'life1, 'async_trait, T, F, Fut>(
&'life0 self,
key: &'life1 str,
ttl: Option<Duration>,
f: F,
) -> Pin<Box<dyn Future<Output = Result<T, CacheError>> + Send + 'async_trait>>where
T: Serialize + DeserializeOwned + Send + 'async_trait,
F: FnOnce() -> Fut + Send + 'async_trait,
Fut: Future<Output = Result<T, CacheError>> + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves and deserializes
key from JSON; otherwise executes f, serializes to JSON, caches, and returns T.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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