[−][src]Struct cached::UnboundCache
Default unbounded cache
This cache has no size limit or eviction policy.
Note: This cache is in-memory only
Implementations
impl<K: Hash + Eq, V> UnboundCache<K, V>
[src]
pub fn new() -> UnboundCache<K, V>
[src]
Creates an empty UnboundCache
pub fn with_capacity(size: usize) -> UnboundCache<K, V>
[src]
Creates an empty UnboundCache
with a given pre-allocated capacity
Trait Implementations
impl<K: Hash + Eq, V> Cached<K, V> for UnboundCache<K, V>
[src]
pub fn cache_get(&mut self, key: &K) -> Option<&V>
[src]
pub fn cache_get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
pub fn cache_set(&mut self, key: K, val: V) -> Option<V>
[src]
pub fn cache_get_or_set_with<F: FnOnce() -> V>(
&mut self,
key: K,
f: F
) -> &mut V
[src]
&mut self,
key: K,
f: F
) -> &mut V
pub fn cache_remove(&mut self, k: &K) -> Option<V>
[src]
pub fn cache_clear(&mut self)
[src]
pub fn cache_reset(&mut self)
[src]
pub fn cache_size(&self) -> usize
[src]
pub fn cache_hits(&self) -> Option<u64>
[src]
pub fn cache_misses(&self) -> Option<u64>
[src]
pub fn cache_capacity(&self) -> Option<usize>
[src]
pub fn cache_lifespan(&self) -> Option<u64>
[src]
pub fn cache_set_lifespan(&mut self, _seconds: u64) -> Option<u64>
[src]
impl<K, V> CachedAsync<K, V> for UnboundCache<K, V> where
K: Hash + Eq + Clone + Send,
[src]
K: Hash + Eq + Clone + Send,
pub fn get_or_set_with<'life0, 'async_trait, F, Fut>(
&'life0 mut self,
key: K,
f: F
) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>> where
V: Send,
F: FnOnce() -> Fut + Send,
Fut: Future<Output = V> + Send,
F: 'async_trait,
Fut: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
key: K,
f: F
) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>> where
V: Send,
F: FnOnce() -> Fut + Send,
Fut: Future<Output = V> + Send,
F: 'async_trait,
Fut: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
pub fn try_get_or_set_with<'life0, 'async_trait, F, Fut, E>(
&'life0 mut self,
key: K,
f: F
) -> Pin<Box<dyn Future<Output = Result<&mut V, E>> + Send + 'async_trait>> where
V: Send,
F: FnOnce() -> Fut + Send,
Fut: Future<Output = Result<V, E>> + Send,
F: 'async_trait,
Fut: 'async_trait,
E: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
key: K,
f: F
) -> Pin<Box<dyn Future<Output = Result<&mut V, E>> + Send + 'async_trait>> where
V: Send,
F: FnOnce() -> Fut + Send,
Fut: Future<Output = Result<V, E>> + Send,
F: 'async_trait,
Fut: 'async_trait,
E: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
impl<K: Clone, V: Clone> Clone for UnboundCache<K, V>
[src]
pub fn clone(&self) -> UnboundCache<K, V>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K: Debug, V: Debug> Debug for UnboundCache<K, V>
[src]
impl<K, V> Eq for UnboundCache<K, V> where
K: Eq + Hash,
V: PartialEq,
[src]
K: Eq + Hash,
V: PartialEq,
impl<K, V> PartialEq<UnboundCache<K, V>> for UnboundCache<K, V> where
K: Eq + Hash,
V: PartialEq,
[src]
K: Eq + Hash,
V: PartialEq,
Auto Trait Implementations
impl<K, V> RefUnwindSafe for UnboundCache<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
[src]
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for UnboundCache<K, V> where
K: Send,
V: Send,
[src]
K: Send,
V: Send,
impl<K, V> Sync for UnboundCache<K, V> where
K: Sync,
V: Sync,
[src]
K: Sync,
V: Sync,
impl<K, V> Unpin for UnboundCache<K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for UnboundCache<K, V> where
K: UnwindSafe,
V: UnwindSafe,
[src]
K: UnwindSafe,
V: UnwindSafe,
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> 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>,