pub trait CacheKeyBuilder {
Show 13 methods
// Required method
fn get_table(&self) -> &str;
// Provided methods
fn get_prefix(&self) -> Option<&str> { ... }
fn get_tenant(&self) -> Option<&str> { ... }
fn set_tenant_id(&mut self, _tenant_id: u64) { ... }
fn get_modular(&self) -> Option<&str> { ... }
fn get_field(&self) -> Option<&str> { ... }
fn get_value_type(&self) -> ValueType { ... }
fn get_expire(&self) -> Option<Duration> { ... }
fn get_pattern(&self) -> String { ... }
fn key(&self, uniques: &[&dyn ToString]) -> CacheKey { ... }
fn hash_field_key(
&self,
field: &dyn ToString,
uniques: &[&dyn ToString],
) -> CacheHashKey { ... }
fn hash_key(&self, uniques: &[&dyn ToString]) -> CacheHashKey { ... }
fn build_key(&self, uniques: &[&dyn ToString]) -> String { ... }
}Required Methods§
Provided Methods§
Sourcefn get_prefix(&self) -> Option<&str>
fn get_prefix(&self) -> Option<&str>
缓存前缀,用于区分项目、环境等
Sourcefn get_tenant(&self) -> Option<&str>
fn get_tenant(&self) -> Option<&str>
租户 ID,用于区分租户 非租户模式返回 None
Sourcefn set_tenant_id(&mut self, _tenant_id: u64)
fn set_tenant_id(&mut self, _tenant_id: u64)
设置租户 ID(默认不做处理,子类可重写)
Sourcefn get_modular(&self) -> Option<&str>
fn get_modular(&self) -> Option<&str>
服务模块名,用于区分后端服务、前端模块等
Sourcefn get_value_type(&self) -> ValueType
fn get_value_type(&self) -> ValueType
缓存的 value 存储的类型
Sourcefn get_expire(&self) -> Option<Duration>
fn get_expire(&self) -> Option<Duration>
缓存自动过期时间
Sourcefn get_pattern(&self) -> String
fn get_pattern(&self) -> String
获取通配符模式