Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Redis

You're reading from   Mastering Redis Take your knowledge of Redis to the next level to build enthralling applications with ease

Arrow left icon
Product type Paperback
Published in May 2016
Publisher Packt
ISBN-13 9781783988181
Length 366 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Vidyasagar N V Vidyasagar N V
Author Profile Icon Vidyasagar N V
Vidyasagar N V
Jeremy Nelson Jeremy Nelson
Author Profile Icon Jeremy Nelson
Jeremy Nelson
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Why Redis? FREE CHAPTER 2. Advanced Key Management and Data Structures 3. Managing RAM – Tips and Techniques for Redis Memory Management 4. Programming Redis Part One – Redis Core, Clients, and Languages 5. Programming Redis Part Two – Lua Scripting, Administration, and DevOps 6. Scaling with Redis Cluster and Sentinel 7. Redis and Complementary NoSQL Technologies 8. Docker Containers and Cloud Deployments 9. Task Management and Messaging Queuing 10. Measuring and Managing Information Streams A. Sources Index

Popular usage patterns

A very popular use pattern for Redis is as an in-memory cache for web applications. Redis is available as a caching option for popular web frameworks such as Django, Ruby-on-Rails, Node.js, and Flask. As a popular caching technology Redis excels in web applications for storing new data while evicting stale data. For web applications, the cached data can range from single HTML character strings, widgets, and elements to entire web pages and websites.

Popular usage patterns

By utilizing Redis's ability to set an expiration time on a key, one of Redis' popular caching strategies called Less Recently Used (LRU) is robust enough to handle even the largest web properties, with the most popular content remaining in cache but stale and little-used data being evicted from the data store. This caching use case doesn't assume that the original web element or page is generated from the data in Redis; most likely, the web content was dynamically generated from other sources of data with Redis, in this use pattern, and operates as an excellent web caching layer in this setup.

The second popular use pattern for Redis is for the metric storage of such quantitative data such as web page usage and user behavior on gamer leaderboards. Using bit operations on strings, Redis very efficiently stores binary information on a particular characteristic. Usage for a website could be stored with a key constructed from a date such as page-usage:2016-11-01, which has a string attached with a bit flipped to 1 the first time a web page is accessed by a user.

Popular usage patterns

The daily usage for the website for November 1 can be obtained through a simple BITCOUNT Redis command on the page-usage:2016-11-01 key. In a 2011 blog post, individuals at a start-up named Spool explain in detail how they use bitmaps and Redis bit operations to store the user activity on their website with this design pattern.

The third popular Redis use pattern is as communication layer between different systems through a publish/subscribe (pub/sub for short) model, where one can post messages to one or more channels that can be acted upon by other systems that have subscribed to or are listening to that channel for incoming messages.

Popular usage patterns

Typically, publishers do not need to know the specific subscribers to send messages to them (say in a point-to-point messaging model); only the message contents and what channel to send the message should be known. Similarly, a subscriber does not need to know individual publishers, only the channel to receive messages. The pub/sub pattern is nice because it scales easily, and the publishers and subscribers can be very different programs and systems.

You have been reading a chapter from
Mastering Redis
Published in: May 2016
Publisher: Packt
ISBN-13: 9781783988181
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime