Struct cornerstore::CornerStore [−][src]
pub struct CornerStore(_);
A thread-safe store for perishable items.
Keys and values are untyped byte-streams of arbitrary length
Implementations
impl CornerStore
[src]
pub fn new() -> Self
[src]
pub fn with_capacity(cap: usize) -> Self
[src]
pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Box<dyn Error>>
[src]
Get an item, but only if it has not expired
pub fn get_key_value(
&self,
key: &[u8]
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Box<dyn Error>>
[src]
&self,
key: &[u8]
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Box<dyn Error>>
Retrieve a key/value paid, but only if they have not expired
pub fn get_unchecked(
&self,
key: &[u8]
) -> Result<Option<Vec<u8>>, Box<dyn Error>>
[src]
&self,
key: &[u8]
) -> Result<Option<Vec<u8>>, Box<dyn Error>>
Retrieve a value, even if it is stale
pub fn get_key_value_unchecked(
&self,
key: &[u8]
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Box<dyn Error>>
[src]
&self,
key: &[u8]
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Box<dyn Error>>
Retrieve a key/value pair, even if the pair is stale.
pub fn set(
&mut self,
key: &[u8],
val: &[u8],
expiry: Option<Instant>
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
key: &[u8],
val: &[u8],
expiry: Option<Instant>
) -> Result<(), Box<dyn Error>>
Sets key to value, overwriting any previous value. Providing an optional expiry
time treats the key/value pair as perishable.
pub fn update(
&mut self,
key: &[u8],
val: &[u8],
expiry: Option<Instant>
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
key: &[u8],
val: &[u8],
expiry: Option<Instant>
) -> Result<(), Box<dyn Error>>
pub fn remove(&mut self, key: &[u8]) -> Result<(), Box<dyn Error>>
[src]
Removes the key/value pair from the store.
pub fn evict(&mut self) -> Result<(), Box<dyn Error>>
[src]
Remove any expired perishable items from the store
Auto Trait Implementations
impl RefUnwindSafe for CornerStore
impl Send for CornerStore
impl Sync for CornerStore
impl Unpin for CornerStore
impl UnwindSafe for CornerStore
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, 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>,