This project illustrates how to send multiple cache requests to Redis in bulk, asynchronously. This approach resembles traditional Redis pipelining. See here for more details about this approach.
cd databases/redis
cargo runTo test the demo, POST a json object containing three strings to the /stuff endpoint:
{
"one": "first entry",
"two": "second entry",
"three": "third entry"
}These three entries will cache to redis, keyed accordingly.
Using HTTPie:
http :8080/stuff one="first entry" two="second entry" three="third entry"Using cURL:
curl localhost:8080/stuff -H 'content-type: application/json' -d '{"one":"first entry","two":"second entry","three":"third entry"}'To delete these, simply issue a DELETE http request to /stuff endpoint
Using HTTPie:
http DELETE :8080/stuffUsing cURL:
curl -XDELETE 127.0.0.1:8080/stuffAt any time, verify the contents of Redis using its CLI:
echo "MGET mydomain:one mydomain:two mydomain:three" | redis-cli