Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

cache: Write cache_key_prefixes without any compression.

Alex Vandiverdb89874bb079
diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py
index 03b12223e1d..a071f44fe19 100644
--- a/zerver/lib/cache.py
+++ b/zerver/lib/cache.py
@@ -69,7 +69,17 @@ def update_cached_cache_key_prefixes() -> list[str]:
continue
with open(filename) as f:
found_prefixes.add(f.readline().removesuffix("\n"))
- caches["default"].set("cache_key_prefixes", list(found_prefixes), timeout=60 * 60 * 24) # 24h
+
+ # We reach into the bmemcached client directly to do this set
+ # *without* compression, so that changes in our choice of
+ # bmemcached compression algorithm are always
+ # backwards-compatible.
+ caches["default"]._cache.set( # type: ignore[attr-defined] # not in stubs
+ caches["default"].make_key("cache_key_prefixes"),
+ list(found_prefixes),
+ 60 * 60 * 24, # 24h
+ compress_level=0,
+ )
return list(found_prefixes)