pip install redis
In python it looks like this
import redis
r = redis.Redis(host='localhost', port=6379, db=0)
#Erase everything
r.flushall()
#Save hash
#key_You can set dict to name
r.hmset(key_name, dict)
#When saving one by one
r.hset(key_name, field_name, val)
#Get hash
r.hgetall(key_name)
#hash key only
r.hkeys(key_name)
#hash value only
r.hvals(key_name)
#Only the specified field
r.hget(key_name, field_name)
#Increment the specified key and field
r.hincrby(key_name, field_name, value)
#Existence check of field
r.hexists(key_name,field_name)
#List of keys
r.keys()
It's good to be able to use it with almost the same interface as the interactive type. If you touch the list while looking at the document, you can easily remember it.
Recommended Posts