pub struct Cache {
pub env: Environment,
pub path: String,
/* private fields */
}
Expand description
LMDB cache. This struct implements the Store trait so it can be used to cache Model structs
Fields§
§env: Environment
LMDB environment
path: String
database path in the filesystem
Implementations§
Trait Implementations§
Source§impl Store for Cache
impl Store for Cache
Source§fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
Stores the value in the database with the corresponding key
Source§fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F,
) -> Result<T, Error>
fn pull<F, T>( &self, db: &'static str, key: &str, formatter: F, ) -> Result<T, Error>
Retrieves the value in the database with the corresponding key
Returns an error if the key doesn’t exists
Source§fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error>
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error>
Iterates over all objects that starts with the prefix and run
the function f. If f returns Continue(false) the iteration stops
Auto Trait Implementations§
impl !Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl !Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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