本文整理汇总了Python中libmc.Client.touch方法的典型用法代码示例。如果您正苦于以下问题:Python Client.touch方法的具体用法?Python Client.touch怎么用?Python Client.touch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libmc.Client
的用法示例。
在下文中一共展示了Client.touch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CmemcachedRegressionCase
# 需要导入模块: from libmc import Client [as 别名]
# 或者: from libmc.Client import touch [as 别名]
#.........这里部分代码省略.........
v = [{"v": BigObject('a', 10)}]
self.mc.set("a", v)
self.assertEqual(self.mc.get("a"), v)
# TODO
'''
raw, flags = self.mc.get_raw("a")
self.assertEqual(raw, pickle.dumps(v, -1))
'''
def test_no_pickle(self):
v = NoPickle()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
self.assertEqual(self.mc.set("nopickle", v), None)
self.assertEqual(self.mc.get("nopickle"), None)
def test_marshal(self):
v = [{2: {"a": 337}}]
self.mc.set("a", v)
self.assertEqual(self.mc.get("a"), v)
# TODO
'''
raw, flags = self.mc.get_raw("a")
self.assertEqual(raw, marshal.dumps(v, 2))
'''
def test_big_list(self):
v = range(1024 * 1024)
r = self.mc.set('big_list', v)
self.assertEqual(r, True)
self.assertEqual(self.mc.get('big_list'), v)
def test_touch(self):
self.mc.set('test', True)
self.assertEqual(self.mc.get('test'), True)
self.assertEqual(self.mc.touch('test', -1), True)
self.assertEqual(self.mc.get('test'), None)
self.mc.set('test', True)
self.assertEqual(self.mc.get('test'), True)
self.assertEqual(self.mc.touch('test', 1), True)
time.sleep(1)
self.assertEqual(self.mc.get('test'), None)
def test_client_pickable(self):
import pickle
d = pickle.dumps(self.mc)
self.mc = pickle.loads(d)
self.test_stats()
def test_stats(self):
s = self.mc.stats()
self.assertEqual(self.server_addr in s, True)
st = s[self.server_addr]
st_keys = {
"pid",
"uptime",
"time",
"version",
"pointer_size",
"rusage_user",
"rusage_system",
"curr_items",
"total_items",
"bytes",