mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-05-15 16:13:10 +00:00
Removes locmem support on Django 1.6.
This commit is contained in:
parent
88788ad92e
commit
43b29a9271
3 changed files with 24 additions and 22 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 it’s not shared between processes, see :ref:`Limits`)
|
||||
(only with Django >= 1.7, and it’s also not shared between processes,
|
||||
see :ref:`Limits`)
|
||||
|
||||
- one of these databases:
|
||||
|
||||
|
|
|
|||
35
settings.py
35
settings.py
|
|
@ -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 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',
|
||||
|
|
@ -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 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)
|
||||
}
|
||||
})
|
||||
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']
|
||||
|
|
|
|||
Loading…
Reference in a new issue