O'Reilly logo

Redis Applied Design Patterns by Arun Chinnachamy

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

The solution overview

Though it is very easy to implement a caching server by using the SET and GET operations, the solution provided here takes advantage of the advanced memory optimization feature in Redis. We will look into a simple solution and then dive into the optimization problem to reduce memory usage.

Simple SET and GET cache servers

If the data to be cached is small and in the range of a few megabytes, we can use a single server with a single Redis instance. In this case, the SET and GET commands are sufficient. For instance, the web page to cache takes the URI as a parameter and generates the page. Then, we store the page contents as a value to a unique key. In this case, instead of storing URI as the key, we can use the hash of URI. ...

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