I have site on Pyramid framework and want to cache with memcached. For testing reasons I've used memory type caching and everything was OK. I'm using pyramid_beaker
package.
Here is my previous code (working version).
In .ini
file
cache.regions = day, hour, minute, second
cache.type = memory
cache.second.expire = 1
cache.minute.expire = 60
cache.hour.expire = 3600
cache.day.expire = 86400
In views.py:
from beaker.cache import cache_region
@cache_region('hour')
def get_popular_users():
#some code to work with db
return some_dict
The only .ini
settings I've found in docs were about working with memory and file types of caching. But I need to work with memcached.
First of all I've installed package memcached
from Ubuntu official repository and also python-memcached
to my virtualenv.
In .ini
file I've replaced cache.type = memory
-> cache.type = memcached
. And I've got next error:
beaker.exceptions.MissingCacheParameter
MissingCacheParameter: url is required
What am I doing wrong?
Thanks in advance!
AttributeError: 'MemcachedNamespaceManager' object has no attribute 'lock_dir'
– Lanark