Skip to main content

create_cache

Function create_cache 

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

Create cache instance

§Arguments

  • config - Cache configuration

§Errors

Returns error if cache type is not supported or configuration is invalid

§Examples

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

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