-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathpush-catalog.py
More file actions
49 lines (19 loc) · 846 Bytes
/
push-catalog.py
File metadata and controls
49 lines (19 loc) · 846 Bytes
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
37
38
39
40
41
42
43
44
45
46
47
48
49
# import the Redis client
import redis
# Create a redis client
redisClient = redis.StrictRedis(host='<Redis DB Endpoint>',
port=6379,
db=0)
# Add key value pairs to the Redis hash
redisClient.hset("users:linus", "name", "Linus" )
redisClient.hset("users:linus", "email", "linus@linuxfoundation.com")
redisClient.hset("users:linus", "phone", "+1234567891")
# Retrieve the value for a specific key
print("Value for the key 3 is")
print(redisClient.hget("users:linus", "phone"))
print("The keys present in the Redis hash:");
print(redisClient.hkeys("users:linus"))
print("The values present in the Redis hash:");
print(redisClient.hvals("users:linus"))
print("The keys and values present in the Redis hash are:")
print(redisClient.hgetall("users:linus"))