本文整理汇总了Python中mc_bin_client.MemcachedClient.prepend方法的典型用法代码示例。如果您正苦于以下问题:Python MemcachedClient.prepend方法的具体用法?Python MemcachedClient.prepend怎么用?Python MemcachedClient.prepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mc_bin_client.MemcachedClient
的用法示例。
在下文中一共展示了MemcachedClient.prepend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from mc_bin_client import MemcachedClient [as 别名]
# 或者: from mc_bin_client.MemcachedClient import prepend [as 别名]
number_of_items = int(options.items)
mc = MemcachedClient("127.0.0.1", 11211)
keys = ["{0}-{1}".format(prefix, i) for i in range(0, number_of_items)]
info("inserting {0} items".format(number_of_items))
for k in keys:
mc.set(k, 0, 0, str(uuid.uuid4())[0:16])
while True:
info("now remove 3 chars from 80% of keys - if < 3 chars delete the key - if key does not exist create it")
for i in range(0, 3):
for k in keys:
try:
a, b, value = mc.get(k)
if len(value) < 3:
mc.delete(k)
else:
mc.set(k, 0, 0, value[0:len(value) - 7])
except:
mc.set(k, 0, 0, str(uuid.uuid4())[0:16])
time.sleep(sleep_time)
for k in keys:
try:
mc.prepend(k, "two")
except:
mc.set(k, 0, 0, str(uuid.uuid4())[0:16])
time.sleep(sleep_time)