Book Image

Redis Applied Design Patterns

By : Arun Chinnachamy
Book Image

Redis Applied Design Patterns

By: Arun Chinnachamy

Overview of this book

<p>With new data stores making their way onto the market, it's necessary for businesses to understand the features and techniques to use data stores most effectively. Redis Applied Design Patterns is designed to guide you into the world of Redis and will help you understand how business problems can be solved using Redis in your application stack.</p> <p>This book introduces you to the NoSQL way of thinking and how it is different from SQL. It helps you understand various functionality of Redis through a series of use cases designed for you to learn the more complex and less well-known features of Redis in an incremental way. By the time you've read this book, you will be capable of designing a system using Redis. This book will guide you through various use cases along with code samples, easy-to-understand diagrams, and tips to help you take advantage of Redis. The book explains the benefits of adding Redis to the application stack and discusses various practical use cases for Redis such as the caching system, commenting system, and social networking.</p>
Table of Contents (18 chapters)

Understanding the different data types in Redis


Strings, lists, hashes, sets, and sorted sets are the basic data types in Redis. Each type has its strengths and should be used appropriately to take complete advantage of these strengths. In this section, we will discuss each type briefly.

Note

To view all the available commands and data types in Redis, visit http://redis.io/commands.

Strings

Strings are the most basic data type in Redis. This basic type is binary safe and is used to create more complex data types such as lists and sets. A string value can hold up to 512 MB of data. Being the most basic type, it can be used to hold anything such as a binary stream of images, data in JSON format, generated HTML cached for faster delivery, and many other use cases.

From Redis 2.6.12, we can even set expiry information in seconds or milliseconds as part of the SET command. Prior to 2.6.12, we can set expiry information through the SETEX command with seconds' precision.

SET mykey myvalue EX 5
GET mykey...