Example #1
0
def check_empty_response(con):
    res = con.noop()
    return iequal(len(res), 1, 1) and iequal(res[0]['op'], COMMANDS['noop'][0])

print("""#--------------------------------# silent get #-------------------------------#""")
key, val, flags = "silentset", "siltensetval", 82
empty(key)
mc.setq(key, val, flags=flags, expire=0, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print("""#--------------------------------# silent put #-------------------------------#""")
key, val, flags = "silentadd", "siltenaddval", 82
empty(key)
mc.addq(key, val, flags=flags, expire=0, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print("""#------------------------------# silent replace #-----------------------------#""")
key, val, flags = "silentreplace", "somevalue", 829
empty(key)
mc.add(key, "xval", 0, 831)
check(key, 831, "xval")
mc.replaceq(key, val, flags=flags, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print("""#------------------------------# silent delete #------------------------------#""")
key, val, flags = "silentdelete", "someval", 19
empty(key)
Example #2
0
def check_empty_response(con):
    res = con.noop()
    return iequal(len(res), 1, 1) and iequal(res[0]["op"], COMMANDS["noop"][0])


print ("""#--------------------------------# silent get #-------------------------------#""")
key, val, flags = "silentset", "siltensetval", 82
empty(key)
mc.setq(key, val, flags=flags, expire=0, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print ("""#--------------------------------# silent put #-------------------------------#""")
key, val, flags = "silentadd", "siltenaddval", 82
empty(key)
mc.addq(key, val, flags=flags, expire=0, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print ("""#------------------------------# silent replace #-----------------------------#""")
key, val, flags = "silentreplace", "somevalue", 829
empty(key)
mc.add(key, "xval", 0, 831)
check(key, 831, "xval")
mc.replaceq(key, val, flags=flags, nosend=True)
check_empty_response(mc)
check(key, flags, val)

print ("""#------------------------------# silent delete #------------------------------#""")
key, val, flags = "silentdelete", "someval", 19
empty(key)