Removes locmem support on Django 1.6.

This commit is contained in:
Bertrand Bordage 2014-12-14 05:57:40 +01:00
parent 88788ad92e
commit 43b29a9271
3 changed files with 24 additions and 22 deletions

View file

@ -32,9 +32,6 @@ 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
@ -42,6 +39,9 @@ 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;
@ -57,4 +57,4 @@ after_success: coveralls
matrix:
exclude:
- python: 2.6
env: DJANGO=">=1.7,<1.8"
env: DJANGO="Django>=1.7,<1.8"

View file

@ -14,7 +14,8 @@ Requirements
- `filebased <https://docs.djangoproject.com/en/1.7/topics/cache/#filesystem-caching>`_
(only with Django >= 1.7 as it was not thread-safe before)
- `locmem <https://docs.djangoproject.com/en/1.7/topics/cache/#local-memory-caching>`_
(but its not shared between processes, see :ref:`Limits`)
(only with Django >= 1.7, and its also not shared between processes,
see :ref:`Limits`)
- one of these databases:

View file

@ -35,15 +35,6 @@ 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 cant
# 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',
@ -60,13 +51,23 @@ CACHES = {
},
}
if django.VERSION >= (1, 7):
CACHES['filebased'] = {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': '/tmp/django_cache',
'OPTIONS': {
'MAX_ENTRIES': 10e9, # (See locmem)
}
}
CACHES.update(
locmem={
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'OPTIONS': {
# We want that limit to be infinite, otherwise we cant
# 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)
}
})
try:
import pylibmc
except ImportError:
@ -77,7 +78,7 @@ else:
'LOCATION': '127.0.0.1:11211',
}
DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'locmem')
DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'redis')
CACHES['default'] = CACHES.pop(DEFAULT_CACHE_ALIAS)
if DEFAULT_CACHE_ALIAS == 'memcached' and 'pylibmc' in CACHES:
del CACHES['pylibmc']