Struct mdl::bcache::Cache [−][src]
pub struct Cache { /* fields omitted */ }
BTreeMap cache. This struct implements the Store trait so it can be used to cache Model structs A BTreeMap is used to store the data in memory. This struct implements clone so it can be shared between threads safely creating a clone
Methods
impl Cache
[src]
impl Cache
Trait Implementations
impl Debug for Cache
[src]
impl Debug for Cache
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Cache
[src]
impl Clone for Cache
fn clone(&self) -> Cache
[src]
fn clone(&self) -> Cache
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Store for Cache
[src]
impl Store for Cache
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
[src]
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
Stores the value in the database with the corresponding key
fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
[src]
fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
Retrieves the value in the database with the corresponding key Returns an error if the key doesn't exists Read more
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error> where
F: Fn(&[u8]) -> Continue,
[src]
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error> where
F: Fn(&[u8]) -> Continue,
Iterates over all objects that starts with the prefix and run the function f. If f returns Continue(false) the iteration stops Read more
fn rm(&self, db: &'static str, key: &str) -> Result<(), Error>
[src]
fn rm(&self, db: &'static str, key: &str) -> Result<(), Error>
Remove the corresponding data in the database by key
fn all<F, T>(
&self,
db: &'static str,
prefix: &str,
formatter: F
) -> Result<Vec<T>, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
[src]
fn all<F, T>(
&self,
db: &'static str,
prefix: &str,
formatter: F
) -> Result<Vec<T>, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
Retrieves all items in the database that starts with the prefix key