2
경쟁 조건이 Celery
입니다. 이것에 영감을 얻어 - http://ask.github.io/celery/cookbook/tasks.html#ensuring-a-task-is-only-executed-one-at-a-time 나는 내 작업에 잠금을 추가하기 위해 memcache를 사용하기로 결정했습니다.memcache가 작동하지 않습니다.
다음은 내가 만든 변경되어이 후
python-memcached
# settings for memcache
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
, 나는 내 껍질에 로그인 한 다음
>>> import os
>>> import django
>>> from django.core.cache import cache
>>> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings.base')
>>> cache
<django.core.cache.DefaultCacheProxy object at 0x101e4c860>
>>> cache.set('my_key', 'hello, world!', 30) #display nothing. No T/F
>>> cache.get('my_key') #Display nothing.
>>> from django.core.cache import caches
>>> caches['default']
<django.core.cache.backends.memcached.MemcachedCache object at 0x1048a5208>
>>> caches['default'].set('my_key', 'hello, world!', 30) #display nothing. No T/F
>>> caches['default'].get('my_key') #Display nothing.
도 pip install python-memcached
이 Python 3.6
을 사용했다 할 Django==1.10.5
내가 뭘하고 있니? 잘못된? 어떤 도움을 주시면 감사하겠습니다.