This is a Janet client library for Redka.
This library can be installed with jpm
using jpm install https://github.com/rokf/janet-redka
or by adding the following line into your project's dependency tuple:
{ :url "https://github.com/rokf/janet-redka" :tag "main" }
After it is installed you should be able to import it using (import redka)
.
The make-client
function takes two optional parameters:
host
(string), defaults to127.0.0.1
port
(number), defaults to6379
It creates a new Redka client that wraps its RESP API. The client can be
used with Janet's with
, because it implements a :close
method.
(def client (redka/make-client "localhost" 6379))
Functions for Redka's commands are generated using a macro because they all follow the same pattern. See commands for details about the commands that Redka supports. See tests and examples for some practical usage examples. They're following the pattern below:
(redka/{command} client & args)
Some commands don't take any arguments. In those cases you'd only have to pass in the client.
Closes the underlying connection stream.
(redka/close client)
Usage examples can be found in the example
folder. It also contains a
Docker Compose specification, which can be used to spin up an appropriately configured
Redka server instance.
Tests can be found in the test
folder. They've been written using judge
.
It can be installed with jpm install https://github.com/ianthehenry/judge
.
MIT - see the LICENSE
file for details.