mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
Adds pylibmc support.
This commit is contained in:
parent
13ea4b0bde
commit
47bb01c7b3
4 changed files with 25 additions and 8 deletions
|
|
@ -6,12 +6,16 @@ Requirements
|
|||
|
||||
- Django 1.6 or 1.7
|
||||
- Python 2.6, 2.7, 3.2, 3.3, or 3.4
|
||||
- `django-redis <https://github.com/niwibe/django-redis>`_,
|
||||
`memcached <https://docs.djangoproject.com/en/1.7/topics/cache/#memcached>`_,
|
||||
`filebased <https://docs.djangoproject.com/en/1.7/topics/cache/#filesystem-caching>`_
|
||||
(only with Django >= 1.7 as it is not thread-safe before),
|
||||
or `locmem <https://docs.djangoproject.com/en/1.7/topics/cache/#local-memory-caching>`_
|
||||
(but it’s not shared between processes, so don’t use it with RQ or Celery)
|
||||
- a cache configured as `default` with one of these backends:
|
||||
|
||||
- `django-redis <https://github.com/niwibe/django-redis>`_
|
||||
- `memcached <https://docs.djangoproject.com/en/1.7/topics/cache/#memcached>`_
|
||||
(using either python-memcached or pylibmc)
|
||||
- `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, so don’t use it with RQ or Celery)
|
||||
|
||||
- PostgreSQL, MySQL or SQLite
|
||||
|
||||
Usage
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ psycopg2
|
|||
MySQL-python
|
||||
django-redis
|
||||
python-memcached
|
||||
pylibmc
|
||||
South
|
||||
|
|
|
|||
11
settings.py
11
settings.py
|
|
@ -65,9 +65,18 @@ CACHES = {
|
|||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
},
|
||||
'pylibmc': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
},
|
||||
}
|
||||
|
||||
CACHES['default'] = CACHES.pop(os.environ.get('CACHE_BACKEND', 'locmem'))
|
||||
DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'locmem')
|
||||
CACHES['default'] = CACHES.pop(DEFAULT_CACHE_ALIAS)
|
||||
if DEFAULT_CACHE_ALIAS == 'memcached':
|
||||
del CACHES['pylibmc']
|
||||
elif DEFAULT_CACHE_ALIAS == 'pylibmc':
|
||||
del CACHES['memcached']
|
||||
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
|
|
|||
5
tox.ini
5
tox.ini
|
|
@ -1,6 +1,7 @@
|
|||
[tox]
|
||||
envlist =
|
||||
py2.6-django1.6-{sqlite3,postgresql,mysql}-{locmem,redis,memcached},
|
||||
py2.6-django1.6-{sqlite3,postgresql,mysql}-{locmem,redis,memcached,pylibmc},
|
||||
py2.7-django{1.6,1.7}-{sqlite3,postgresql,mysql}-pylibmc,
|
||||
py{2.7,3.2,3.3,3.4}-django1.7-{sqlite3,postgresql,mysql}-filebased,
|
||||
py{2.7,3.2,3.3,3.4}-django{1.6,1.7}-{sqlite3,postgresql,mysql}-{locmem,redis,memcached},
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ deps =
|
|||
py2.6: unittest2
|
||||
py{2.6,2.7}: MySQL-python
|
||||
py{2.6,2.7}: python-memcached
|
||||
py{2.6,2.7}: pylibmc
|
||||
py{3.2,3.3,3.4}: https://github.com/clelland/MySQL-for-Python-3/tarball/master
|
||||
py{3.2,3.3,3.4}: python3-memcached
|
||||
setenv =
|
||||
|
|
@ -31,5 +33,6 @@ setenv =
|
|||
filebased: CACHE_BACKEND=filebased
|
||||
redis: CACHE_BACKEND=redis
|
||||
memcached: CACHE_BACKEND=memcached
|
||||
pylibmc: CACHE_BACKEND=pylibmc
|
||||
commands =
|
||||
coverage run -a --source=cachalot ./runtests.py
|
||||
|
|
|
|||
Loading…
Reference in a new issue