i want to cache in django so I am using low level API caching but even after adding it shows none
>>> from django.core.cache import cache
>>> cache.set('my_key', 'hello, world!')
>>> cache.get('my_key')
>>> print(cache.get('my_key'))
None
>>>
in my settings.py
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
even when i use cache.add('my_key', 'hello, world!', 30)
it return false
2
Answers
this setting worked for me
You can try to set timeout:
You can set the timeout to None to remove it completely.