spin_key_value_redis/
lib.rsmod store;
use serde::Deserialize;
use spin_factor_key_value::runtime_config::spin::MakeKeyValueStore;
use store::KeyValueRedis;
#[derive(Default)]
pub struct RedisKeyValueStore {
_priv: (),
}
impl RedisKeyValueStore {
pub fn new() -> Self {
Self::default()
}
}
#[derive(Deserialize)]
pub struct RedisKeyValueRuntimeConfig {
url: String,
}
impl MakeKeyValueStore for RedisKeyValueStore {
const RUNTIME_CONFIG_TYPE: &'static str = "redis";
type RuntimeConfig = RedisKeyValueRuntimeConfig;
type StoreManager = KeyValueRedis;
fn make_store(
&self,
runtime_config: Self::RuntimeConfig,
) -> anyhow::Result<Self::StoreManager> {
KeyValueRedis::new(runtime_config.url)
}
}