Skip to main content

KeyDB Releases Version 5.1 – Check Out What’s New!

We are excited to introduce version 5.1 which includes new stable features to the RELEASE_5 branch. If you haven’t been keeping up with KeyDB here are a few things you can expect to see!

  • You can now expire individual members of a set with EXPIREMEMBER and EXPIREMEMBERAT
  • The EXPIRE command has been updated enabling near real time, active deletion of expired keys. This has major improvements for heavy users of the EXPIRE feature
  • EXPIRE and EXPIREMEMBER now use less memory than they used to
  • OBJECT now has a new subcommand, LASTMODIFIED allowing you to see time since a key was modified (does not include reads)
  • BITOP now has LSHIFT and RSHIFT options available
  • TTL and PTTL have been modified for use with subkey expires
  • KeyDB is now benchmarking at 5X the speed of Redis for a single node

EXPIRE#

link to the EXPIRE command

KeyDB now uses a deterministic algorithm to actively delete expired keys in a linear fashion. This results in close to real time removal of expired keys. For heavy users of the EXPIRE command, this can result in considerable savings in memory usage.

Previously a randomized algorithm was used and when the number of expires started increasing, the ability to actively remove overdue tags would get worse. Take the example below of time to remove 100 expired keys from a database with 10,000 keys containing expires. It is non-linear and takes a while to remove the keys. On datasets with more expires and where a higher ratio of active expires (TTL>0) to overdue expires (TTL<=0), you may have keys waiting days to be deleted.

image

In the scenario above, with the updated algorithm the KeyDB keys are removed in less than 1 sec

Another great feature is that the updates to the EXPIRE feature are not more cpu intensive and actually use approximately 10% less memory than before.

Check out this article for a deeper dive into the changes made here

EXPIREMEMBER#

link to the EXPIREMEMBER command

KeyDB now has support for subkey expires. This means you can set an expire on individual members of a set. The command is EXPIREMEMBER and actually uses about 5% less memory than that of a conventional EXPIRE (prior to EXPIRE updates – compare to Redis)

Command format: EXPIREMEMBER key member delay [Unit: ms,s]

EXPIREMEMBERAT#

link to the EXPIREMEMBERAT command

This is a new command, similar to EXPIREMEMBER however instead of specifying the time, you specify the unix timestamp at which to expire the subkey.

Command format: EXPIREMEMBERAT key member timestamp

TTL & PTTL#

links to TTL & PTTL commands

These commands have been updated to work with subkey expires so you can query the time remaining on expires placed on members of a set

Command format for subkeys TTL key member or PTTL key member

OBJECT LASTMODIFIED#

link to the OBJECT LASTMODIFIED command

OBJECT now has a new subcommand, LASTMODIFIED, which returns the time elapsed (in seconds) since the key was last modified. This differs from IDLETIME as it is not affected by reads of a key.

Command format: OBJECT LASTMODIFIED key

BITOP LSHIFT & RSHIFT#

links to BITOP LSHIFT & BITOP RSHIFT commands

This is a new addition to BITOP to enable a bitwise shift left or right by a specified amount. This is little endian format and provides new capabilities for working with bitstrings and other.

Command format: BITOP LSHIFT key integer or BITOP RSHIFT key integer

Stay Connected#

If you have a feature request you would like to see put into KeyDB please create an issue on Github and we will take a serious look at it!

To keep up to date with the latest from KeyDB please subscribe to our mailing list . We try to keep emails informative about the project, and avoid spamming

If you have an interesting use case or loading scenario you would like to share please reach out to us at support@eqalpha.com