Memcached client wrapper that is configured via environment variables
Memcached client wrapper that is configured via environment variables.
sprockets.clients.memcached is available on the Python Package Index and can be installed via pip or easy_install:
pip install sprockets.clients.memcached
The following example sets the environment variables for connecting to memcached on 192.168.1.2 and 192.168.1.3 and subsequently issuing a few memcached commands:
import os from sprockets.clients import memcached os.environ['MEMCACHED_SERVERS'] = '192.168.1.2:11211,192.168.1.3:11211' client = memcached.Client() client.set('foo', 'bar') print(client.get('foo'))