mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
cache: Delete unused function cache().
This commit is contained in:
parent
9c99962dea
commit
a9794ec001
@ -407,22 +407,6 @@ def generic_bulk_cached_fetch(
|
||||
return dict((object_id, cached_objects[cache_keys[object_id]]) for object_id in object_ids
|
||||
if cache_keys[object_id] in cached_objects)
|
||||
|
||||
def cache(func: Callable[..., ReturnT]) -> Callable[..., ReturnT]:
|
||||
"""Decorator which applies Django caching to a function.
|
||||
|
||||
Uses a key based on the function's name, filename, and
|
||||
the repr() of its arguments."""
|
||||
|
||||
func_uniqifier = '%s-%s' % (func.__code__.co_filename, func.__name__)
|
||||
|
||||
@wraps(func)
|
||||
def keyfunc(*args: Any, **kwargs: Any) -> str:
|
||||
# Django complains about spaces because memcached rejects them
|
||||
key = func_uniqifier + repr((args, kwargs))
|
||||
return key.replace('-', '--').replace(' ', '-s')
|
||||
|
||||
return cache_with_key(keyfunc)(func)
|
||||
|
||||
def preview_url_cache_key(url: str) -> str:
|
||||
return "preview_url:%s" % (make_safe_digest(url),)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user