[−][src]Struct futures_cache::Cache
Primary cache abstraction.
Can be cheaply cloned and namespaced.
Implementations
impl Cache
[src]
pub fn load(db: 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 !RefUnwindSafe for Cache
[src]
impl Send for Cache
[src]
impl Sync for Cache
[src]
impl Unpin for Cache
[src]
impl !UnwindSafe for Cache
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut 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.
pub 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>,