pub struct Cache<T: 'static> { /* private fields */ }
Expand description
Cache for each Writium Api. Any Writium Api can be composited with this struct for cache.
Implementations§
Source§impl<T: 'static> Cache<T>
impl<T: 'static> Cache<T>
pub fn new<Src>(capacity: usize, src: Src) -> Cache<T>where
Src: 'static + CacheSource<Value = T>,
Sourcepub fn create(&self, id: &str) -> Result<Arc<CacheItem<T>>>
pub fn create(&self, id: &str) -> Result<Arc<CacheItem<T>>>
Get the object identified by given ID. If the object is not cached, try recovering its cache from provided source. If there is no space for another object, the last recently accessed cache will be disposed.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Cache<T>
impl<T> !RefUnwindSafe for Cache<T>
impl<T> Send for Cache<T>
impl<T> Sync for Cache<T>
impl<T> Unpin for Cache<T>
impl<T> !UnwindSafe for Cache<T>
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