mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use maxsize=None
for more LRU-caches
Not only is the implementation faster and simpler, but in cases where the functions take arguments, there's a slight chance of having fewer cache misses.
This commit is contained in:
parent
578ae520f3
commit
20e35ddc06
@ -614,7 +614,7 @@ class BlockField(forms.Field):
|
||||
)
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
@lru_cache(maxsize=None)
|
||||
def get_help_icon():
|
||||
return render_to_string(
|
||||
"wagtailadmin/shared/icon.html", {"name": "help", "classname": "default"}
|
||||
|
@ -35,7 +35,7 @@ def get_model_from_url_params(app_name, model_name):
|
||||
return model
|
||||
|
||||
|
||||
@lru_cache
|
||||
@lru_cache(maxsize=None)
|
||||
def get_setting_edit_handler(model):
|
||||
if hasattr(model, "edit_handler"):
|
||||
edit_handler = model.edit_handler
|
||||
|
@ -256,7 +256,7 @@ def find_available_slug(parent, requested_slug, ignore_page_id=None):
|
||||
return slug
|
||||
|
||||
|
||||
@functools.lru_cache
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def get_content_languages():
|
||||
"""
|
||||
Cache of settings.WAGTAIL_CONTENT_LANGUAGES in a dictionary for easy lookups by key.
|
||||
|
@ -5,7 +5,7 @@ from django.core.checks import Warning, register
|
||||
from willow.image import Image
|
||||
|
||||
|
||||
@lru_cache
|
||||
@lru_cache(maxsize=None)
|
||||
def has_jpeg_support():
|
||||
wagtail_jpg = os.path.join(os.path.dirname(__file__), "check_files", "wagtail.jpg")
|
||||
succeeded = True
|
||||
@ -19,7 +19,7 @@ def has_jpeg_support():
|
||||
return succeeded
|
||||
|
||||
|
||||
@lru_cache
|
||||
@lru_cache(maxsize=None)
|
||||
def has_png_support():
|
||||
wagtail_png = os.path.join(os.path.dirname(__file__), "check_files", "wagtail.png")
|
||||
succeeded = True
|
||||
|
@ -19,7 +19,7 @@ features = FeatureRegistry()
|
||||
# with the feature registry
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
@lru_cache(maxsize=None)
|
||||
def get_rewriter():
|
||||
embed_rules = features.get_embed_types()
|
||||
link_rules = features.get_link_types()
|
||||
|
Loading…
Reference in New Issue
Block a user