Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MatthewDarnell/RedisBigNum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

RedisBigNum

A simple Redis module for setting and incrementing big numbers. Native Redis INCRBY and HINCRBY commands are limited to signed 64-bit integers.

Usage

Loading the module

Load the module through redis either through:

redis-server --loadmodule /path/to/bignumber.so

or inside redis.conf loadmodule /path/to/bignumber.so

or at runtime MODULE LOAD /path/to/bignumber.so

Using the module

127.0.0.1:6379> BIGNUM someKey SET 1
OK
127.0.0.1:6379> BIGNUM someKey INCRBY 10000000000000000000000000000000000000000000000000
OK
127.0.0.1:6379> GET someKey
"10000000000000000000000000000000000000000000000001"
127.0.0.1:6379> BIGNUM someKey INCRBY -10000000000000000000000000000000000000000000000000
OK
127.0.0.1:6379> GET someKey
"1"
127.0.0.1:6379> BIGNUM someKey INCRBY -1
OK
127.0.0.1:6379> GET someKey
"0"

Note, this module only works on whole numbers. Decimals are not supported.

Building

RedisBigNum only requires one external dependency, libgmp.

On Mac: brew install gmp

On Debian Linux: sudo apt-get install libgmp3-dev

Then simply run: $ make

This will output bignumber.so which can then be loaded into redis.

About

A simple Redis module for setting and incrementing big numbers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /