[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/lqlstudio/netkiller.github.io/master/python/python-memcached.html [Back]  [Original]

9.6.python-memcached
Home | Mirror | Search | | ITEYE | OSChina | 51CTO
q:

9.6.python-memcached

Python
wget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.34.tar.gz
tar zxvf python-memcached-1.34.tar.gz
cd python-memcached-1.34
		

# python setup.py install

running install
running build
running build_py
creating build
creating build/lib
copying memcache.py -> build/lib
running install_lib
copying build/lib/memcache.py -> /usr/lib/python2.3/site-packages
byte-compiling /usr/lib/python2.3/site-packages/memcache.py to memcache.pyc

		

9.1.memcached.py

import memcache
mc = memcache.Client(['127.0.0.1:11211'], debug=1)

mc.set("some_key", "Some value")
value = mc.get("some_key")
print value

mc.set("another_key", 3)
mc.delete("another_key")

mc.set("key", "1")   # note that the key used for incr/decr must be a string.
mc.incr("key")
mc.decr("key")
			

comments powered by Disqus

Web Proxy Viewer  |  New URL  |  Original Page