diff --git a/.travis.yml b/.travis.yml index fc9132b..4b6492d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,9 @@ before_script: - mysql -u root -e 'CREATE DATABASE cachalot;' script: + - CACHE_BACKEND=locmem DB_ENGINE=sqlite3 coverage run -a --source=cachalot ./runtests.py + - CACHE_BACKEND=locmem DB_ENGINE=postgresql coverage run -a --source=cachalot ./runtests.py + - CACHE_BACKEND=locmem DB_ENGINE=mysql coverage run -a --source=cachalot ./runtests.py - CACHE_BACKEND=redis DB_ENGINE=sqlite3 coverage run -a --source=cachalot ./runtests.py - CACHE_BACKEND=redis DB_ENGINE=postgresql coverage run -a --source=cachalot ./runtests.py - CACHE_BACKEND=redis DB_ENGINE=mysql coverage run -a --source=cachalot ./runtests.py @@ -39,9 +42,6 @@ script: - CACHE_BACKEND=memcached DB_ENGINE=postgresql coverage run -a --source=cachalot ./runtests.py - CACHE_BACKEND=memcached DB_ENGINE=mysql coverage run -a --source=cachalot ./runtests.py - if [[ $DJANGO == "Django>=1.7,<1.8" ]]; then - CACHE_BACKEND=locmem DB_ENGINE=sqlite3 coverage run -a --source=cachalot ./runtests.py; - CACHE_BACKEND=locmem DB_ENGINE=postgresql coverage run -a --source=cachalot ./runtests.py; - CACHE_BACKEND=locmem DB_ENGINE=mysql coverage run -a --source=cachalot ./runtests.py; CACHE_BACKEND=filebased DB_ENGINE=sqlite3 coverage run -a --source=cachalot ./runtests.py; CACHE_BACKEND=filebased DB_ENGINE=postgresql coverage run -a --source=cachalot ./runtests.py; CACHE_BACKEND=filebased DB_ENGINE=mysql coverage run -a --source=cachalot ./runtests.py; diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 24fc500..c115003 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -15,8 +15,7 @@ Requirements - `filebased `_ (only with Django >= 1.7 as it was not thread-safe before) - `locmem `_ - (only with Django >= 1.7, and it’s also not shared between processes, - see :ref:`Limits`) + (but it’s not shared between processes, see :ref:`Limits`) - one of these databases: diff --git a/settings.py b/settings.py index 928f8ab..18a4102 100644 --- a/settings.py +++ b/settings.py @@ -35,6 +35,17 @@ DATABASES['default'] = DATABASES.pop(os.environ.get('DB_ENGINE', 'sqlite3')) CACHES = { + 'locmem': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'OPTIONS': { + # We want that limit to be infinite, otherwise we can’t + # reliably count the number of SQL queries executed in tests. + + # In this context, 10e9 is enough to be considered + # infinite. + 'MAX_ENTRIES': 10e9, + } + }, 'redis': { 'BACKEND': 'django_redis.cache.RedisCache', 'LOCATION': 'redis://127.0.0.1:6379/0', @@ -51,23 +62,13 @@ CACHES = { }, } if django.VERSION >= (1, 7): - CACHES.update( - locmem={ - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - 'OPTIONS': { - # We want that limit to be infinite, otherwise we can’t - # reliably count the number of SQL queries executed in tests. - # In this context, 10e9 is enough to be considered infinite. - 'MAX_ENTRIES': 10e9, - } - }, - filebased={ - 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', - 'LOCATION': '/tmp/django_cache', - 'OPTIONS': { - 'MAX_ENTRIES': 10e9, # (See locmem) - } - }) + CACHES['filebased'] = { + 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', + 'LOCATION': '/tmp/django_cache', + 'OPTIONS': { + 'MAX_ENTRIES': 10e9, # (See locmem) + } + } try: import pylibmc except ImportError: @@ -78,7 +79,7 @@ if django.VERSION >= (1, 7): 'LOCATION': '127.0.0.1:11211', } -DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'redis') +DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'locmem') CACHES['default'] = CACHES.pop(DEFAULT_CACHE_ALIAS) if DEFAULT_CACHE_ALIAS == 'memcached' and 'pylibmc' in CACHES: del CACHES['pylibmc']