diff options
author | rtkay123 <dev@kanjala.com> | 2025-08-12 05:13:32 +0200 |
---|---|---|
committer | rtkay123 <dev@kanjala.com> | 2025-08-12 05:13:32 +0200 |
commit | c5ea875f544824b0c042bf7c0a58b3134f9c0373 (patch) | |
tree | 4913d4ff2b408c7157e33894e40deec570ecce9e /crates/configuration/src/state/cache_key.rs | |
parent | 9c850d6c4d0ed468709c2eb5340d7b64bbb9aa68 (diff) | |
download | warden-c5ea875f544824b0c042bf7c0a58b3134f9c0373.tar.bz2 warden-c5ea875f544824b0c042bf7c0a58b3134f9c0373.zip |
feat(config): get active routing
Diffstat (limited to 'crates/configuration/src/state/cache_key.rs')
-rw-r--r-- | crates/configuration/src/state/cache_key.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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<W>(&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()); + } +} |