[][src]Trait wascc_actor::KeyValueStore

pub trait KeyValueStore {
    fn get(&self, key: &str) -> Result<Option<String>>;
fn set(&self, key: &str, value: &str, expires: Option<u32>) -> Result<()>;
fn atomic_add(&self, key: &str, value: i32) -> Result<i32>;
fn list_add(&self, key: &str, item: &str) -> Result<usize>;
fn list_del_item(&self, key: &str, item: &str) -> Result<usize>;
fn del_key(&self, key: &str) -> Result<()>;
fn list_range(
        &self,
        key: &str,
        start: isize,
        stop_inclusive: isize
    ) -> Result<Vec<String>>;
fn list_clear(&self, key: &str) -> Result<()>;
fn set_add(&self, key: &str, value: &str) -> Result<usize>;
fn set_remove(&self, key: &str, value: &str) -> Result<usize>;
fn set_union(&self, keys: Vec<String>) -> Result<Vec<String>>;
fn set_intersect(&self, keys: Vec<String>) -> Result<Vec<String>>;
fn set_members(&self, key: &str) -> Result<Vec<String>>;
fn exists(&self, key: &str) -> Result<bool>; }

Represents an abstraction around a client consuming a Key-Value store provided by the host

Required methods

fn get(&self, key: &str) -> Result<Option<String>>

Retrieves the value for a given key, returning the value and whether or not it existed.

fn set(&self, key: &str, value: &str, expires: Option<u32>) -> Result<()>

Sets the value for a given key

fn atomic_add(&self, key: &str, value: i32) -> Result<i32>

Performs an atomic add operation, returning the new value

fn list_add(&self, key: &str, item: &str) -> Result<usize>

Adds a string value to a list stored within a given key

fn list_del_item(&self, key: &str, item: &str) -> Result<usize>

Deletes all occurrences of an item in a list

fn del_key(&self, key: &str) -> Result<()>

Deletes the given key

fn list_range(
    &self,
    key: &str,
    start: isize,
    stop_inclusive: isize
) -> Result<Vec<String>>

Requests a list of values contained within a given key

fn list_clear(&self, key: &str) -> Result<()>

Clears a list

fn set_add(&self, key: &str, value: &str) -> Result<usize>

Adds an item to a set

fn set_remove(&self, key: &str, value: &str) -> Result<usize>

Removes an item from a set

fn set_union(&self, keys: Vec<String>) -> Result<Vec<String>>

Returns the union of sets indicated by list of keys

fn set_intersect(&self, keys: Vec<String>) -> Result<Vec<String>>

Returns the intersection of all sets indicated by the list of keys

fn set_members(&self, key: &str) -> Result<Vec<String>>

Returns all members of a given set

fn exists(&self, key: &str) -> Result<bool>

Indicates whether or not a given key exists in the data store

Loading content...

Implementors

impl KeyValueStore for DefaultKeyValueStore[src]

Loading content...