Trait RedisModel

Source
pub trait RedisModel {
    // Required methods
    fn _prefix_key() -> &'static str;
    fn _get_pk(&self) -> &str;
    fn _set_pk(&mut self, pk: String);

    // Provided methods
    fn _ensure_pk(&mut self) { ... }
    fn _fmt_pk(pk: &str) -> String { ... }
    fn _is_pk_fmt(pk: &str) -> bool { ... }
    fn _get_redis_key(&self) -> String { ... }
    fn _expire_cmd(&self, secs: usize) -> RedisResult<Cmd> { ... }
}
Expand description

Shared Redis Object Model

Required Methods§

Source

fn _prefix_key() -> &'static str

Get Redis key to be used in storing HashModel object. This should by default that HashModel name in lowercase.

Source

fn _get_pk(&self) -> &str

Get primary key

Source

fn _set_pk(&mut self, pk: String)

Get primary key

Provided Methods§

Source

fn _ensure_pk(&mut self)

Ensure primary key

Source

fn _fmt_pk(pk: &str) -> String

Get key “{self::redis_key}:{pk}”

Source

fn _is_pk_fmt(pk: &str) -> bool

Check if str is of format “{self::redis_key}:{pk}”

Source

fn _get_redis_key(&self) -> String

Get key “{self::redis_key}:{self._get_primary_key()}”

Source

fn _expire_cmd(&self, secs: usize) -> RedisResult<Cmd>

Expire Self at given duration

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§