本文整理汇总了Python中pykt.KyotoTycoon.cas方法的典型用法代码示例。如果您正苦于以下问题:Python KyotoTycoon.cas方法的具体用法?Python KyotoTycoon.cas怎么用?Python KyotoTycoon.cas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykt.KyotoTycoon
的用法示例。
在下文中一共展示了KyotoTycoon.cas方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cas_few_param2
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_few_param2():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.cas("A", oval="B")
ok_(ret == True)
ret = db.get("A")
ok_(ret == None)
db.close()
示例2: test_cas_utf8
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_utf8():
db = KyotoTycoon()
db = db.open()
db.set("あいうえお", "かきくけこ")
ret = db.cas("あいうえお", oval="かきくけこ", nval="さしすせそ")
ok_(ret == True)
ret = db.get("あいうえお")
ok_(ret == "さしすせそ")
db.close()
示例3: test_cas
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.cas("A", oval="B", nval="C")
ok_(ret == True)
ret = db.get("A")
ok_(ret == "C")
db.close()
示例4: test_cas_expire
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_expire():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.cas("A", oval="B", nval="C", expire=2)
ok_(ret)
time.sleep(3)
ret = db.get("A")
ok_(ret == None)
db.close()
示例5: test_cas_loop
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_loop():
db = KyotoTycoon()
db = db.open()
db.set("A", "0")
for i in xrange(100):
a = str(i)
b = str(i+1)
ret = db.cas("A", oval=a, nval=b)
ok_(ret == True)
ret = db.get("A")
ok_(ret == b)
db.close()
示例6: test_cas_few_param1
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_few_param1():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
db.cas("A", nval="C")
示例7: test_cas_fail
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_fail():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.cas("A", oval="C", nval="C")
示例8: test_cas_with_db
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_cas_with_db():
db = KyotoTycoon("test")
db = db.open()
db.set("A", "B")
db.cas("A", oval="B", nval="C")
ok_(False)
示例9: test_err_cas
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import cas [as 别名]
def test_err_cas():
db = KyotoTycoon()
db.cas("A")