Memcached is a general-purpose distributed memory caching system. It could delivery 10~20 time speed boost than Mysql.

opkg update 
opkg install memcached
/etc/init.d/memcached  start
/etc/init.d/memcached  enable
opkg update 
opkg install python-openssl 
opkg install distribute 
easy_install python-memcached
nano /mnt/sda1/memcacheyun.py
#!/usr/bin/python
import memcache
mc = memcache.Client(['127.0.0.1:11211'], debug=0)
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")
print  mc.get("key")
mc.decr("key")
print  mc.get("key")
root@Arduino:chmod 755 /mnt/sda1/memcacheyun.py
root@Arduino:/mnt/sda1/memcacheyun.py
Some value
None
2
1

 

Comments powered by CComment