Redis

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contains strings, hashes, lists, sets, sorted sets.

Learn more →

What is ..?

Redis as a data store. Redis is Fast. It’s essentially memcached with more elaborate data types than just string values. Even some advanced operations like set intersection, zset range requests, are blindingly fast. There’s all kinds of reasons to use Redis for fast changing, heavily accessed data. It’s used quite often as a cache that can be rebuilt from a backing alternative primary database for this reason. It’s a compelling replacement for memcached allowing more advanced caching for the different kinds of data you store.

Like memcached, everything is held in memory. Redis does persist to disk, but it doesn’t synchronously store data to disk as you write it. These are the two primary reasons Redis sucks as a primary store:

      • You have to be able to fit all your data in memory.
      • If your server fails between disk syncs you lose anything that was sitting in memory.

Due to these two issues Redis has found a really solid niche as a transient cache of data you can lose, rather than a primary data store, making often accessed data fast with the ability to rebuild when necessary.

Why ..?

Redis gives you much greater flexibility regarding the objects you can cache. Whereas Memcached limits key names to 250 bytes, limits values to 1MB, and works only with plain strings, Redis allows key names and values to be as large as 512MB each, and they are binary safe. Redis has six data types that enable more intelligent caching and manipulation of cached data, opening up a world of possibilities to the application developer.

Instead of storing objects as serialized strings, we can use a Redis Hash to store an object's fields and values and manage them using a single key. Redis Hash saves the need to fetch the entire string, deserialize it, update a value, reserialize the object, and replace the entire string in the cache with its new value for every trivial update and that means lower resource consumption and increased performance. Other data types that Redis offers, such as Lists and Sets.

Last but not least, Redis offers replication. Replication can be used for implementing a highly available cache setup that can withstand failures and provide uninterrupted service to the application. Considering a cache failure falls only slightly short of application failure in terms of the impact on user experience and application performance, having a proven solution that guarantees the cache's contents and service availability is a major advantage in most cases.

Try it !

Ready for a test drive? Check this interactive tutorial that will walk you through the most important features of Redis.

Quick links

Benchmarks