Pages

Thursday, September 18, 2014

Python memcache Client - Sample Code

Python memcache Client - Sample Code

A Sample Python Client for Memcache based on memcache module


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

    mc.set("name", "Krishnan")
    value = mc.get("name") 
    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")
 
 
Solution Reference :
 
http://stackoverflow.com/questions/868690/good-examples-of-python-memcache-memcached-being-used-in-python 

No comments:

Post a Comment