Memcached
glim-memcached
glim-memcached is a glim framework extension for bringing up memcached features to glim. It uses pinterest's memcache module.
Installation
- install pymemcache
# install glim-extensions from pip
pip install glim-extensions
Configuration
Append the following config to the extensions config;
# app/config/<env>.py
config = {
'extensions' : {
'memcached' : {
'default' : {
'host' : 'localhost',
'port' : 11211,
}
# add a new dict for connecting multiple redis
# servers
}
},
# ...
}
Here default is used for connection aliasing. Memcached can handle multiple connections.
Start your web server and that's it!
Usage
from glim_extensions.memcached import Cache
# performs operations in default connection
Cache.set('foo', 'bar')
Cache.get('foo')
# performs operations in aliased connection
Cache.connection('connection-name').set('foo', 'bar')
Updated less than a minute ago