Extension modules to Redis' native data types and commands
cargo +nightly build --release
redis-server --loadmodule ./target/release/libredisrest.so
Note: Redis REST Module uses Rocket web frameworks that must be build using nightly version of Rust.
Let's get, set and delete key in Redis:
curl -X GET http://localhost:8000/set/foo/bar
curl -X GET http://localhost:8000/get/foo
curl -X GET http://localhost:8000/del/foo
Increment a value
curl -X GET http://localhost:8000/set/num/1
curl -X GET http://localhost:8000/get/num
curl -X GET http://localhost:8000/incr/num
curl -X GET http://localhost:8000/get/num
Set and get a hash
curl -X GET http://localhost:8000/hset/hfoo/key1/val1/key2/val2
curl -X GET http://localhost:8000/hgetall/hfoo
curl -X GET http://localhost:8000/hmset/hfoo/key1/new_value1
curl -X GET http://localhost:8000/hgetall/hfoo
You have the pattern...
Enjoy!
see: https://rocket.rs/v0.4/guide/configuration/
For example:
ROCKET_ENV=production ROCKET_PORT=8080 redis-server --loadmodule ./target/release/libredisrest.so