async fn create_dyn_cache(config: &config::AppConfig) -> Box<dyn cache::ImageCache> {
    match config.cache_engine.as_str() {
        #[cfg(feature = "ce-filesystem")]
        "fs" => Box::new(
            cache::FileSystemCache::new(config.fs_opt.as_ref().expect("fs ce config not provided"))
                .await
                .expect("unable to initialize fs cache engine"),
        ),
        #[cfg(feature = "ce-rocksdb")]
        "rocksdb" => Box::new(
            cache::RocksCache::new(
                config
                    .rocks_opt
                    .as_ref()
                    .expect("rocksdb ce config not provided"),
            )
            .expect("unable to initialize RocksDB cache engine"),
        ),
        a => panic!("\"{}\" is not a valid cache engine", a),
    }
}
/// Dynamically creates the cache implementation based on the configured cache engine
///
/// ## Panic
///
/// This function will 100% of the time panic if there is a problem with the configuration of the
/// cache engine, there is an error creating the cache engine itself, or if the provided name is
/// invaid.
Dynamically creates the cache implementation based on the configured cache engine
Dynamically creates the cache implementation based on the configured cache engine
async fn create_dyn_cache(config: &config::AppConfig) -> Box<dyn cache::ImageCache> {
    match config.cache_engine.as_str() {
        #[cfg(feature = "ce-filesystem")]
        "fs" => Box::new(
            cache::FileSystemCache::new(config.fs_opt.as_ref().expect("fs ce config not provided"))
                .await
                .expect("unable to initialize fs cache engine"),
        ),
        #[cfg(feature = "ce-rocksdb")]
        "rocksdb" => Box::new(
            cache::RocksCache::new(
                config
                    .rocks_opt
                    .as_ref()
                    .expect("rocksdb ce config not provided"),
            )
            .expect("unable to initialize RocksDB cache engine"),
        ),
        a => panic!("\"{}\" is not a valid cache engine", a),
    }
}
async fn create_dyn_cache ( config : & config :: AppConfig ) -> Box < dyn cache :: ImageCache > { match config . cache_engine . as_str ( ) { # [ cfg ( feature " " ) ] " " => Box :: new ( cache :: FileSystemCache :: new ( config . fs_opt . as_ref ( ) . expect ( " " ) ) . await . expect ( " " ) , ) , # [ cfg ( feature " " ) ] " " => Box :: new ( cache :: RocksCache :: new ( config . rocks_opt . as_ref ( ) . expect ( " " ) , ) . expect ( " " ) , ) , a => panic ! ( " \" \" " a ) , } }
Dynamically creates the cache implementation based on the configured cache engine
Dynamically creates the cache implementation based on the configured cache engine
config
&config::AppConfig
panic
This function will 100% of the time panic if there is a problem with the configuration of the
cache engine, there is an error creating the cache engine itself, or if the provided name is
invaid.
This function will 100% of the time panic if there is a problem with the configuration of the cache engine there is an error creating the cache engine itself or if the provided name is invaid .