LRU key evictions

To demonstrate the various options for key evictions in Redis, we'll start with a simple example by setting a small memory Redis instance that the maxmemory directive sets to 1 megabyte. The maxmemory directive allows you set a hard upper bound on the amount of memory that is available to a running Redis instance. Echoing the warnings in the default redis.conf file, setting the maxmemory has ramifications that we'll now see. To start with, we'll just create a very simple Redis key schema, that of generating and storing a unique id for a web application. After connecting to a Redis instance through Redis-cli, we'll run the following commands to clear out our datastore and then set the maxmemory directive to 1 megabyte:> ...

Get Mastering Redis now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.