Adds bigint support to redis using the redis module system.
Install Redis v4.0+
Install rustup
git clone https://github.com/ahouts/redis-bigint
cd redis-bigint
cargo build --release
# change the ".so" to the file extension for shared libraries on your OS
redis-server --loadmodule ./target/release/libredis_bigint.so
Documentation about loading redis modules can be found here.
Set a key to the desired value. The value is a string which will be interpreted as
a base radix
integer.
BIGINT.SET <key> <value> [radix: 10]
> BIGINT.SET a 10
(nil)
> BIGINT.SET b 123456789abcdef 16
(nil)
Get the value of a bigint. The return value is a base radix
string.
BIGINT.GET <key> [radix: 10]
> BIGINT.SET a 12345
(nil)
> BIGINT.GET a
12345
> BIGINT.GET a 2
11000000111001
Add the value of two bigints together, storing the result in the first bigint.
BIGINT.ADD <target> <other>
> BIGINT.SET a 1234
(nil)
> BIGINT.SET b 4321
(nil)
> BIGINT.ADD a b
(nil)
> BIGINT.GET a
5555
Add a value (in base 10) to a bigint.
The value of int
must fit in a 64 bit signed integer.
BIGINT.ADDINT <target> <int>
> BIGINT.SET a 1234
(nil)
> BIGINT.ADDINT a 4321
(nil)
> BIGINT.GET a
5555