Provides a ecmc.MemcacheClient
class that uses AWS Elasticache autodiscovery
to find all servers in the Elasticache cluster, proxy's memcache.Client
from
python-memcached, and uses
hash_ring to provide consistent
hashing to determine the correct server within the cluster for a given key
even when servers are added or removed.
For detail on AWS Elasticache autodiscovery, please reference:
http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.html
$ pip install ecmc
>>> from ecmc import MemcacheClient
>>> mc = MemcacheClient('test.lwgyhw.cfg.usw2.cache.amazonaws.com:11211')
>>> mc.set('foo', 'bar')
True
>>> mc.get('foo')
'bar'
All methods available for memcached.Client
from python-memcached are
available on the MemcacheClient
instance.
GNU LGPL v3. See the LICENSE
file.
Most of this code came from https://github.com/yupeng820921/elasticache_pyclient .