mirror of
https://github.com/zulip/zulip.git
synced 2025-10-31 20:13:46 +00:00
When flushing caches, we want to ensure that even processes which may have a wrong cache-key-prefix know to fetch the latest data from the database. This is complicated by the cache-key-prefixes being stored on disk, and thus checking that every cache delete is not sufficiently performant. We store the list of cache-key-prefixes in the cache, itself, with no prefix. This cache is updated when a new cache-key is written, and is also allowed to lapse after 24 hours. Updating this global cache entry on new prefix creation ensures that even a not-yet-restarted-into deployment will have its caches appropriately purged if changes are made to the underlying data. However, this both adds a cache-get, as well as multiplies the size of all cache clears; for large bulk clears (e.g. for stream renames, which clear the cache for all message-ids in them) this may prove untenable.