When Memcached Beats Redis

But there are two specific scenarios in which Memcached could be preferable. The first is for caching small and static data, such as HTML code fragments. Memcached’s internal memory management, while not as sophisticated as Redis’, is more efficient because Memcached will consume comparatively less memory resources for metadata. Strings, which are the only data type that are supported by Memcached, are ideal for storing data that’s only being read because strings require no further processing.

.. Memcached’s data eviction mechanism uses an LRU (Least Recently Used) algorithm and somewhat arbitrarily evicts data that’s similar in size to the new data. Redis, by contrast, allows for fine-grained control over eviction though a choice of six different eviction policies. Redis also employs more sophisticated approaches to memory management and eviction candidate selection.

.. 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.