Skip to content

memcached

Luke Chen edited this page Dec 26, 2020 · 12 revisions

https://github.com/memcached/memcached/wiki

https://realpython.com/python-memcache-efficient-caching/

lchen154@ubuntu:~/Downloads$ pip3 install pymemcache
lchen154@ubuntu:~/Downloads$ python3
>>> from pymemcache.client import base
>>> client = base.Client(('localhost', 11211))
>>> data1 = ["apple", "banana", "cherry"]
>>> client.set('data1', data1)
True
>>> client.get('data1')
b"['apple', 'banana', 'cherry']"
>>> data = client.get('data1')
>>> data
b"['apple', 'banana', 'cherry']"
>>> client.set('data2', 'Hungry birds')
True
>>> client.get('data2')
b'Hungry birds'

Clone this wiki locally