To build RedisDecimal, ensure you have cmake
and make
, and afterwards run the following command.
cmake .
make
If the build is successful, you'll have a shared library called libdecimal.so
in the lib
directory.
To load the library, pass its path to the --loadmodule
directive when starting redis-server
:
$ redis-server --loadmodule ./lib/libdecimal.so
# redis-cli
127.0.0.1:6379>
And run the following command:
127.0.0.1:6379> DECIMAL KEY ADD 10
"30.000000"
127.0.0.1:6379> DECIMAL KEY SUB 10
"-10.000000"
127.0.0.1:6379> DECIMAL KEY MUL 10
"200.000000"
127.0.0.1:6379> DECIMAL KEY DIV 10
"0.500000"
To build RedisDecimal, and run the unit testing.
cmake .
make
./.tests/tests