Skip to main content

KVSClient

Trait KVSClient 

Source
pub trait KVSClient: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<String>;
    fn set(&mut self, key: &str, value: String, ttl: Option<u64>) -> bool;
    fn delete(&mut self, key: &str) -> bool;
}
Expand description

KVSクライアント Redis等のKVS操作

KVSは文字列のみを扱う(primitive型)。 serialize/deserializeはState層で行う。

Required Methods§

Source

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

キーから値を取得

§Returns
  • Some(String) - 取得成功
  • None - キーが存在しない
Source

fn set(&mut self, key: &str, value: String, ttl: Option<u64>) -> bool

キーに値を設定

§Arguments
  • key - キー
  • value - 値(文字列)
  • ttl - TTL(秒)
Source

fn delete(&mut self, key: &str) -> bool

キーを削除

Implementors§