Struct df_cache::Cache

source ·
pub struct Cache { /* private fields */ }

Implementations§

链接配置

  • config 配置
{
  "default": "redis",
  "connections": {
    "redis": {
     "mode": "redis",
     "hostname": "127.0.0.1",
     "hostport": 6379
    }
  }
}
Examples found in repository?
examples/test.rs (line 12)
5
6
7
8
9
10
11
12
13
fn main() {
    let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
    let dir = dir.join("config");
    let config_path = dir.join("cache.json");

    let conf = fs::read_to_string(config_path.to_str().unwrap()).unwrap();
    let conf = json::parse(conf.as_str().clone()).unwrap();
    let _cache = Cache::connect(conf);
}

选择数据库

设置缓存

  • time 过期时间 s 秒

获取缓存

删除缓存

设置列表缓存

获取列表缓存

设置消息队列

获取消息队列

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.