JSON | Redis
The JSON capability of Redis Stack provides JavaScript Object Notation (JSON) support for Redis. It lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. Redis JSON also works seamlessly with Search and Query to let you index and query JSON documents.
not "free", much bigger size than standard Redis
https://hub.docker.com/r/redis/redis-stack/tagsredis-stack: 337 MB compressed, linux/amd64
https://hub.docker.com/_/redis/tagsredis: 49 MB compressed, linux/amd64
docker run -d --name redis-stack -p 6380:6379 redis/redis-stack
docker exec -it redis-stack sh
# redis-cli
ping
PONG
python example
> pip install redis
> python redis-json.py
import redis
data = {
'dog': {
'scientific-name' : 'Canis familiaris'
}
}
r = redis.Redis(host='localhost', port=6380, decode_responses=True)
r.json().set('doc', '$', data)
doc = r.json().get('doc', '$')
dog = r.json().get('doc', '$.dog')
scientific_name = r.json().get('doc', '$..scientific-name')
print(scientific_name)
# ['Canis familiaris']