mirror of https://github.com/zulip/zulip.git
51db22c86c
We have historically cached two types of values on a per-request basis inside of memory: * linkifiers * display recipients Both of these caches were hand-written, and they both actually cache values that are also in memcached, so the per-request cache essentially only saves us from a few memcached hits. I think the linkifier per-request cache is a necessary evil. It's an important part of message rendering, and it's not super easy to structure the code to just get a single value up front and pass it down the stack. I'm not so sure we even need the display recipient per-request cache any more, as we are generally pretty smart now about hydrating recipient data in terms of how the code is organized. But I haven't done thorough research on that hypotheseis. Fortunately, it's not rocket science to just write a glorified memoize decorator and tie it into key places in the code: * middleware * tests (e.g. asserting db counts) * queue processors That's what I did in this commit. This commit definitely reduces the amount of code to maintain. I think it also gets us closer to possibly phasing out this whole technique, but that effort is beyond the scope of this PR. We could add some instrumentation to the decorator to see how often we get a non-trivial number of saved round trips to memcached. Note that when we flush linkifiers, we just use a big hammer and flush the entire per-request cache for linkifiers, since there is only ever one realm in the cache. |
||
---|---|---|
.. | ||
development | ||
__init__.py | ||
alert_words.py | ||
attachments.py | ||
auth.py | ||
compatibility.py | ||
custom_profile_fields.py | ||
digest.py | ||
documentation.py | ||
drafts.py | ||
email_mirror.py | ||
events_register.py | ||
home.py | ||
hotspots.py | ||
invite.py | ||
message_edit.py | ||
message_fetch.py | ||
message_flags.py | ||
message_send.py | ||
muted_users.py | ||
presence.py | ||
push_notifications.py | ||
reactions.py | ||
read_receipts.py | ||
realm.py | ||
realm_domains.py | ||
realm_emoji.py | ||
realm_export.py | ||
realm_icon.py | ||
realm_linkifiers.py | ||
realm_logo.py | ||
realm_playgrounds.py | ||
registration.py | ||
report.py | ||
scheduled_messages.py | ||
sentry.py | ||
storage.py | ||
streams.py | ||
submessage.py | ||
thumbnail.py | ||
tutorial.py | ||
typing.py | ||
unsubscribe.py | ||
upload.py | ||
user_groups.py | ||
user_settings.py | ||
user_topics.py | ||
users.py | ||
video_calls.py | ||
zephyr.py |