Example #1
0
client.set('kx', {'vx': {'vy': 0, 'vz': [1, 2.34, 3]}})

a = client.get('kx')
print(client.get('kx'))
print(f"expecting: 2.34 received: a['vx']['vz'][1]={a['vx']['vz'][1]}")

#client.flush()
#

#print(client.blpop('list1'))

print(client.lpush('list1', 3.3))
print(client.lpush('list1', 5.634354234, 3, "abc", [3, 5, 6, 7.7]))
print(f"expecting 5, getting {client.llen('list1')}")
print(client.rpop('list1'))
print(f"expecting 4, getting {client.llen('list1')}")
#print(client.get('list1'))

#print(client.blpop('newlist')) # need extra command to test block operations.

print(client.lpush('newlist', 77))

logging.info("Done")

# testing bytes
randomfile = os.urandom(10 * 1024 * 1024)
pfile = pickle.dumps(randomfile)
logging.info(
    f"About to write a big data, filesize={sys.getsizeof(randomfile)}, pickled size={sys.getsizeof(pfile)}"
)