-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_rkey.py
More file actions
38 lines (30 loc) · 1 KB
/
Copy pathcheck_rkey.py
File metadata and controls
38 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import redis
from rediscluster import RedisCluster
import argparse
import os
import csv
startup_nodes = [{"host": '10.52.0.181', "port": '6379'}]
key_id_map = RedisCluster(startup_nodes=startup_nodes)
all_keys = key_id_map.keys()
k = "2599" + "_" + "591432"
return_tup = key_id_map.hgetall(k)
print("-----------------------------------")
print(return_tup)
print("-----------------------------------")
byte_image = return_tup[b'imgbyte']
print(byte_image)
print("-----------------------------------")
image_timestamp = int(return_tup[b'timestamp'].decode('utf-8'))
print(image_timestamp)
currtimestamp = 7
updated_timestamp = currtimestamp
tup_val = {"imgbyte": byte_image, "timestamp": currtimestamp}
key_id_map.hmset(k, tup_val)
print(key_id_map.exists(k))
return_tup = key_id_map.hgetall(k)
print(f"return_tup: {return_tup}")
print("-----------------------------------")
print(key_id_map.hgetall('367_81604'))
if key_id_map.exists('367_81604'):
key_id_map.delete('367_81604')
print(key_id_map.hgetall('367_81604'))