Skip to main content

create_cache

Function create_cache 

Source
pub fn create_cache(config: &CacheConfig) -> Result<Box<dyn Cache>, Error>
Expand description

创建缓存实例

§参数

  • config - 缓存配置

§错误

如果缓存类型不支持或配置无效,返回错误

§示例

use crates_docs::cache::{CacheConfig, create_cache};

let config = CacheConfig::default();
let cache = create_cache(&config).expect("Failed to create cache");