Storage

Trait Storage 

Source
pub trait Storage {
    // Required methods
    fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Option<Vec<u8>>;
    fn get(&self, key: &[u8]) -> Option<Vec<u8>>;
    fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>;
}
Expand description

Storage trait

Required Methods§

Source

fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Option<Vec<u8>>

set K for V

Source

fn get(&self, key: &[u8]) -> Option<Vec<u8>>

get V by K

use Vec<u8> as return because some implementation is hard to return &[u8]

Source

fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>

Remove a key

Implementors§

Source§

impl<Memory: Clone> Storage for Cache<Memory>