本文整理汇总了Python中pykt.KyotoTycoon.get方法的典型用法代码示例。如果您正苦于以下问题:Python KyotoTycoon.get方法的具体用法?Python KyotoTycoon.get怎么用?Python KyotoTycoon.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykt.KyotoTycoon
的用法示例。
在下文中一共展示了KyotoTycoon.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_duble
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_duble():
db = KyotoTycoon()
db = db.open()
ret = db.append("A", "B")
ok_(ret == True)
ok_(db.get("A") == "B")
ret = db.append("A", "B")
ok_(ret == True)
ok_(db.get("A") == "BB")
示例2: test_set_bulk_utf8
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_set_bulk_utf8():
db = KyotoTycoon()
db = db.open()
ret = db.set_bulk(d2)
ok_(ret == 2)
ret = db.get("あいうえお")
ok_(ret == "ABC")
ret = db.get("かきくけこ")
ok_(ret == "てすと2")
db.close()
示例3: test_set_bulk
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_set_bulk():
db = KyotoTycoon()
db = db.open()
ret = db.set_bulk(d)
ok_(ret == 2)
ret = db.get("A")
ok_(ret == "B")
ret = db.get("C")
ok_(ret == "D")
db.close()
示例4: test_set_bulk_atomic
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_set_bulk_atomic():
db = KyotoTycoon()
db = db.open()
ret = db.set_bulk(d, atomic=True)
ok_(ret == 2)
ret = db.get("A")
ok_(ret == "B")
ret = db.get("C")
ok_(ret == "D")
db.close()
示例5: test_remove_utf8
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_remove_utf8():
db = KyotoTycoon()
db = db.open()
db.set("あいうえお", "かきくけこ")
ret = db.get("あいうえお")
ok_(ret == "かきくけこ")
ret = db.remove("あいうえお")
ok_(ret == True)
ret = db.get("あいうえお")
ok_(ret == None)
db.close()
示例6: test_remove
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_remove():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.get("A")
ok_(ret == "B")
ret = db.remove("A")
ok_(ret == True)
ret = db.get("A")
ok_(ret == None)
db.close()
示例7: test_append_expire_not_expire
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_append_expire_not_expire():
db = KyotoTycoon()
db = db.open()
ret = db.append("A", "B", expire=3)
ok_(ret)
time.sleep(2)
ret = db.get("A")
ok_(ret == "B")
time.sleep(2)
ret = db.get("A")
ok_(ret == None)
db.close()
示例8: test_replace_expire_not_expire
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_replace_expire_not_expire():
db = KyotoTycoon()
db = db.open()
ret = db.set("A", "B")
ret = db.replace("A", "B", expire=3)
ok_(ret)
time.sleep(2)
ret = db.get("A")
ok_(ret == "B")
time.sleep(2)
ret = db.get("A")
ok_(ret == None)
db.close()
示例9: test_cas_expire_not_expire
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_cas_expire_not_expire():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.cas("A", oval="B", nval="C", expire=2)
ok_(ret)
time.sleep(2)
ret = db.get("A")
ok_(ret == "C")
time.sleep(2)
ret = db.get("A")
ok_(ret == None)
db.close()
示例10: test_remove_loop
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_remove_loop():
db = KyotoTycoon()
db = db.open()
for i in xrange(100):
db.set("A", "B")
ret = db.get("A")
ok_(ret == "B")
ret = db.remove("A")
ok_(ret == True)
ret = db.get("A")
ok_(ret == None)
db.close()
示例11: test_get
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_get():
db = KyotoTycoon()
db = db.open()
db.set("A", "B")
ret = db.get("A")
ok_(ret == "B")
db.close()
示例12: test_get_utf8
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_get_utf8():
db = KyotoTycoon()
db = db.open()
db.set("あいうえお", "かきくけこ")
ret = db.get("あいうえお")
ok_(ret == "かきくけこ")
db.close()
示例13: test_remove_with_db
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_remove_with_db():
db = KyotoTycoon("test")
db = db.open()
ret = db.remove("A")
ok_(ret == False)
ret = db.get("A")
ok_(ret == None)
db.close()
示例14: test_mapping_protocol
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_mapping_protocol():
db = KyotoTycoon()
db = db.open()
ret = db["M"] = "MAP"
ok_(ret)
ret = db.get("M")
ok_(ret == "MAP")
db.close()
示例15: test_set_large_key
# 需要导入模块: from pykt import KyotoTycoon [as 别名]
# 或者: from pykt.KyotoTycoon import get [as 别名]
def test_set_large_key():
db = KyotoTycoon()
db = db.open()
ret = db.set("L" * 1024 * 4, "L")
ok_(ret)
ret = db.get("L" * 1024 * 4)
ok_(ret == "L")
db.close()