memcached获取对象
We store key-values all time but I belive that the time to get these values have came :). Now we will look how to get values by providing keys. The simplest syntax in memcached is get operation.
我们一直存储键值,但我相信获得这些值的时机已经到来了:)。 现在,我们将研究如何通过提供键来获取值。 memcached中最简单的语法是get操作。
get key1 [key2] [key3]
get is the verb of the operation.
get是操作的动词。
key1 is the key of the value we want to get
key1是我们要获取的值的键
key2,key3,… are the keys we want to get. We can get multiple values with single get.
key2,key3,…是我们要获取的键。 我们可以一次获得多个值。
add poftut 0 100 4
test
STORED
get poftut
VALUE poftut 0 4
test
END
As the first we add out key as we have learned before.
作为第一个,我们添加了之前学到的密钥。
get is the verb of the operation
get是操作的动词
poftut is the key of the value
Poftut是价值的关键
VALUE is value options like name flag size
VALUE是值选项,例如名称标志大小
test is the value we are looking for
测试是我们正在寻找的价值
END means transaction is successfully ended.
END表示事务已成功结束。
Python应用 (Python Application)
import memcache
client=memcache.Client([('127.0.0.1',11211)])
samp={"poftut2":"test"}
client.add("sample",samp,time=1000)
print(client.get("sample"))
When executed following output is given
执行后,给出以下输出
$ python3 get
{'poftut2': 'test'}
翻译自: https://www.poftut.com/memcached-get-operation-python-example/
memcached获取对象