本文整理汇总了Python中transaction.Transaction.get方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.get方法的具体用法?Python Transaction.get怎么用?Python Transaction.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Transaction
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import get [as 别名]
from transaction import Transaction
if __name__ == '__main__':
transaction = Transaction(None)
line = sys.stdin.readline().rstrip()
while line != "END":
try:
args = line.split()
if args[0] == "SET":
key = args[1]
value = args[2]
transaction.set(key, value)
elif args[0] == "GET":
key = args[1]
value = transaction.get(key)
print value if value != None else "NULL"
elif args[0] == "UNSET":
key = args[1]
transaction.unset(key)
elif args[0] == "NUMEQUALTO":
value = args[1]
print str(transaction.numEqualTo(value))
elif args[0] == "BEGIN":
transaction = transaction.createChild()
elif args[0] == "COMMIT":
transaction = transaction.commit({})
elif args[0] == "ROLLBACK":
if transaction.parent != None:
transaction = transaction.parent
else: