summaryrefslogtreecommitdiff
path: root/django/apps/registry.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/apps/registry.py')
-rw-r--r--django/apps/registry.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/apps/registry.py b/django/apps/registry.py
index 1cdb33b7f0..0683f3ad3c 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -165,7 +165,7 @@ class Apps:
raise LookupError(message)
# This method is performance-critical at least for Django's test suite.
- @functools.lru_cache(maxsize=None)
+ @functools.cache
def get_models(self, include_auto_created=False, include_swapped=False):
"""
Return a list of all installed models.
@@ -280,14 +280,14 @@ class Apps:
raise LookupError("Model '%s.%s' not registered." % (app_label, model_name))
return model
- @functools.lru_cache(maxsize=None)
+ @functools.cache
def get_swappable_settings_name(self, to_string):
"""
For a given model string (e.g. "auth.User"), return the name of the
corresponding settings name if it refers to a swappable model. If the
referred model is not swappable, return None.
- This method is decorated with lru_cache because it's performance
+ This method is decorated with @functools.cache because it's performance
critical when it comes to migrations. Since the swappable settings don't
change after Django has loaded the settings, there is no reason to get
the respective settings attribute over and over again.