[−][src]Struct futures_cache::Cache
Primary cache abstraction.
Can be cheaply cloned and namespaced.
Methods
impl Cache
[src]
pub fn load(db: Arc<Tree>) -> Result<Cache, Error>
[src]
Load the cache from the database.
pub fn delete_with_ns<N, K>(&self, ns: Option<&N>, key: K) -> Result<(), Error> where
N: Serialize,
K: Serialize,
[src]
N: Serialize,
K: Serialize,
Delete the given key from the specified namespace.
pub fn list_json(&self) -> Result<Vec<JsonEntry>, Error>
[src]
List all cache entries as JSON.
pub fn namespaced<N>(&self, ns: &N) -> Result<Self, Error> where
N: Serialize,
[src]
N: Serialize,
Create a namespaced cache.
The namespace must be unique to avoid conflicts.
Each call to this functions will return its own queue for resolving futures.
pub fn insert<K, T>(
&self,
key: K,
age: Duration,
value: &T
) -> Result<(), Error> where
K: Serialize,
T: Serialize,
[src]
&self,
key: K,
age: Duration,
value: &T
) -> Result<(), Error> where
K: Serialize,
T: Serialize,
Insert a value into the cache.
pub fn test<K>(&self, key: K) -> Result<State<()>, Error> where
K: Serialize,
[src]
K: Serialize,
Test an entry from the cache.
pub fn get<K, T>(&self, key: K) -> Result<State<T>, Error> where
K: Serialize,
T: DeserializeOwned,
[src]
K: Serialize,
T: DeserializeOwned,
Load an entry from the cache.
pub async fn wrap<'a, K, F, T, E>(
&'a self,
key: K,
age: Duration,
future: F
) -> Result<T, E> where
K: Serialize,
F: Future<Output = Result<T, E>>,
T: Serialize + DeserializeOwned,
E: From<Error>,
[src]
&'a self,
key: K,
age: Duration,
future: F
) -> Result<T, E> where
K: Serialize,
F: Future<Output = Result<T, E>>,
T: Serialize + DeserializeOwned,
E: From<Error>,
Wrap the result of the given future to load and store from cache.
Trait Implementations
Auto Trait Implementations
impl Sync for Cache
impl Unpin for Cache
impl Send for Cache
impl !UnwindSafe for Cache
impl !RefUnwindSafe for Cache
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,