O'Reilly logo

Mastering Redis by Jeremy Nelson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

127.0.0.1:6379> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required