AWS News Blog
Amazon ElastiCache Update – Redis 2.8.19 Now Available
You can use Amazon ElastiCache to easily create, scale, and maintain cloud-based in-memory key-value stores that use the Memcached or Redis engines.
Today we are making ElastiCache even more useful by adding support for version 2.8.19 of the Redis engine. Compared to version 2.8.6 (until now the latest version supported by ElastiCache Redis), this version of Redis adds an important new data type known as a HyperLogLog, along with some other commands, some functionality improvements, and some bug fixes.
Let’s take a closer look at each of these items.
HyperLogLog
A HyperLogLog is a compact (12 KB per key) Redis data object that can quickly and efficiently tabulate and approximate the number of unique elements in a set (mathematicians like to call this the cardinality).
Let’s say that you had a web site and wanted to keep reasonably close track the number of times per week each of your registered users visited the site, without wanting to update and query a database while generating each page. You would simply create a HyperLogLog and add (using the Redis PFADD command) a new occurrence as part of each visit, using the user name as the key. At any point you can call PFCOUNT to receive an estimate (with a standard error of 0.81%) of the number of visits made by the user or by multiple users (depending on how you use the command).
Because the data structure is compact and does not grow as the number of keys or occurrences of keys grows, you could conceivably use one HyperLogLog for each of the major pages on your site. After you implement this, you can then use the PFMERGE command to merge the HyperLogLogs for each page into a single value that will allow you to approximate the number of pages on the site accessed by each user.
Needless to say, this is a very powerful data object and one that should allow you to implement some interesting new functions for your application without adding much in the way of storage or processing requirements.
Additional Commands
This version of Redis also includes the following new commands:
- ROLE – Return information about the replication state (master or slave) of the Redis instance.
- BITPOS – Return the position of the first 0 or 1 bit (as desired ) in a string.
- COMMAND – Return an array of details about all Redis commands.
Enhancements & Bug Fixes
The sorted set data type now supports lexicographic range queries by way of the ZRANGEBYLEX, ZLEXCOUNT, and ZREMRANGEBYLEX commands.
Redis 2.8.19 also introduces several bug fixed including one which caused the primary to fail a SYNC operation if the child process used to implement state saving terminated unexpectedly. This had an impact on the correctness of the data on the replica.
This version of the Redis engine is available now and you can start using it today!
— Jeff;