Struct persistentcache::storage::file_memory::FileMemoryStorage [−][src]
pub struct FileMemoryStorage { /* fields omitted */ }
FileMemoryStorage
struct
Methods
impl FileMemoryStorage
[src]
impl FileMemoryStorage
pub fn new(path: &str) -> Result<Self, Error>
[src]
pub fn new(path: &str) -> Result<Self, Error>
Creates the path
directory and returns a FileMemoryStorage
struct.
Example
use persistentcache::storage::file_memory::FileMemoryStorage; let mut s = FileMemoryStorage::new(".example_dir").unwrap();
Trait Implementations
impl PersistentCache for FileMemoryStorage
[src]
impl PersistentCache for FileMemoryStorage
fn get(&mut self, name: &str) -> Result<Vec<u8>, Error>
[src]
fn get(&mut self, name: &str) -> Result<Vec<u8>, Error>
Returns the value corresponding to the variable name
.
If it is stored in the hash map, it will retreive it from there, otherwise it will retreive
it from the file system.
fn set(&mut self, name: &str, val: &[u8]) -> Result<(), Error>
[src]
fn set(&mut self, name: &str, val: &[u8]) -> Result<(), Error>
Writes the data of type &[u8]
in array val
to the file corresponding to the variable name
.
fn flush(&mut self) -> Result<(), Error>
[src]
fn flush(&mut self) -> Result<(), Error>
Delete all variables stored in path
(see new()
) which start with PREFIX_
.
Auto Trait Implementations
impl Send for FileMemoryStorage
impl Send for FileMemoryStorage
impl Sync for FileMemoryStorage
impl Sync for FileMemoryStorage