You are previewing Redis Applied Design Patterns.
O'Reilly logo
Redis Applied Design Patterns

Book Description

Use Redis' features to enhance your software development through a wide range of practical design patterns

In Detail

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.

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.

What You Will Learn

  • Get introduced to the NoSQL way of thinking
  • Use pub/sub to implement a notification system
  • Explore various data structures in Redis including HyperLogLog
  • Understand simple use cases such as the cache management system
  • Use Redis in analytics and real-time tracking
  • Implement a leaderboard in gaming using sorted sets
  • Implement a commenting system using Redis and code samples
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Redis Applied Design Patterns
      1. Table of Contents
      2. Redis Applied Design Patterns
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. The SQL and NoSQL Way
        1. Data modeling for relational databases
          1. Normalization
        2. The NoSQL Way
        3. Summary
      9. 2. Transactions and Locks
        1. Transactions in SQL systems
        2. Maintaining data consistency in Redis
        3. Transactions in Redis
        4. Summary
      10. 3. Data Types in Redis
        1. Understanding the different data types in Redis
          1. Strings
          2. Lists
          3. Sets
          4. Sorted sets
          5. Hashes
          6. HyperLogLog
        2. Key expiration
        3. Summary
      11. 4. Redis as a Caching Server
        1. What is caching
        2. The solution overview
          1. Simple SET and GET cache servers
        3. Summary
      12. 5. Redis in an E-commerce Inventory System
        1. A product catalog
          1. The catalog search
        2. Inventory management
          1. The solution overview
        3. Summary
      13. 6. Redis in Autosuggest
        1. Autosuggest systems
          1. Word completion in Redis
          2. Multiword phrase completion
            1. Searching in the index
        2. The faceted search
        3. Summary
      14. 7. Redis in Real-time Analysis
        1. Redis in an analytics system
          1. Capturing data in Redis
          2. Analysis of data
        2. Session management and analysis using Redis
          1. Why use Redis
        3. Summary
      15. 8. Redis in Gaming
        1. Leaderboards in Redis
        2. The notification center
          1. The problem statement
          2. Publish/subscribe
            1. The solution overview
        3. Summary
      16. 9. Redis in a Commenting System
        1. A nonthreaded comment system
          1. Posting a new comment
            1. Updating an existing comment
            2. Displaying the comments
        2. Threaded comments
          1. Updating or deleting a comment
          2. Displaying a comment tree
        3. Summary
      17. 10. Redis in Advertising Networks
        1. The ad inventory
          1. Choosing the best ad to serve
          2. Pausing or stopping a campaign
        2. Frequency capping
          1. Selecting an ad with frequency capping
        3. Keyword targeting
          1. Selecting an ad based on keyword targeting
        4. Summary
      18. 11. Redis in Social Networks
        1. Building your own social network
          1. Storing user information
          2. Authenticating a user
          3. Building a relationship with the user
            1. Adding a friend
            2. Accepting a friend request
            3. Unfriending a user
          4. Updating posts and status
          5. Status update feed
          6. Commenting on posts
        2. Summary
      19. Index