mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Retrieve message objects from memcached in a bulk request.
On my laptop, this saves about 80 milliseconds per 1000 messages requested via get_old_messages queries. Since we only have one memcached process and it does not run with special priority, this might have significant impact on load during server restarts. (imported from commit 06ad13f32f4a6d87a0664c96297ef9843f410ac5)
This commit is contained in:
@@ -67,6 +67,13 @@ def cache_with_key(keyfunc, cache_name=None, timeout=None):
|
||||
|
||||
return decorator
|
||||
|
||||
def cache_get_many(keys, cache_name=None):
|
||||
if cache_name is None:
|
||||
cache_backend = djcache
|
||||
else:
|
||||
cache_backend = get_cache(cache_name)
|
||||
return cache_backend.get_many(keys)
|
||||
|
||||
def cache(func):
|
||||
"""Decorator which applies Django caching to a function.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user