From c5ea875f544824b0c042bf7c0a58b3134f9c0373 Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Tue, 12 Aug 2025 05:13:32 +0200 Subject: feat(config): get active routing --- crates/configuration/src/state/cache_key.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 crates/configuration/src/state/cache_key.rs (limited to 'crates/configuration/src/state/cache_key.rs') diff --git a/crates/configuration/src/state/cache_key.rs b/crates/configuration/src/state/cache_key.rs new file mode 100644 index 0000000..a63b15d --- /dev/null +++ b/crates/configuration/src/state/cache_key.rs @@ -0,0 +1,21 @@ +use warden_stack::redis::ToRedisArgs; + +#[derive(Clone, Copy, Debug)] +pub enum CacheKey<'a> { + ActiveRouting, + Routing(&'a uuid::Uuid), +} + +impl ToRedisArgs for CacheKey<'_> { + fn write_redis_args(&self, out: &mut W) + where + W: ?Sized + warden_stack::redis::RedisWrite, + { + let value = match self { + CacheKey::ActiveRouting => "routing.active".into(), + CacheKey::Routing(uuid) => format!("routing.{uuid}"), + }; + + out.write_arg(value.as_bytes()); + } +} -- cgit v1.2.3