[Fixed]-Django default cache

16👍

In https://docs.djangoproject.com/en/stable/topics/cache/#local-memory-caching says:

Local-memory caching

This is the default cache if another is not specified in your settings
file

updated dead link

8👍

Empirically

>>> from django.conf import settings
>>> settings.CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
>>> 

1👍

By default, Local-memory caching is used which is one of django caches.

So, because Local-memory caching is default, you don’t need to write the code for Local-memory caching to "settings.py" as shown below unless you use multiple local memory caches:

# "settings.py"

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'unique-snowflake',
    }
}

Leave a comment