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§
Sourcefn _prefix_key() -> &'static str
fn _prefix_key() -> &'static str
Get Redis key to be used in storing HashModel object. This should by default that HashModel name in lowercase.
Provided Methods§
Sourcefn _ensure_pk(&mut self)
fn _ensure_pk(&mut self)
Ensure primary key
Sourcefn _is_pk_fmt(pk: &str) -> bool
fn _is_pk_fmt(pk: &str) -> bool
Check if str is of format “{self::redis_key}:{pk}”
Sourcefn _get_redis_key(&self) -> String
fn _get_redis_key(&self) -> String
Get key “{self::redis_key}:{self._get_primary_key()}”
Sourcefn _expire_cmd(&self, secs: usize) -> RedisResult<Cmd>
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.