Take this
course

Software Development / Big Data & Analytics

Learning Redis

Develop applications with lightning fast data access using Redis

Description

A database is the backbone of any application, and for developers working with varied and sizable data sets, selecting an appropriate data store is a critical development consideration. Redis, an in-memory, key-value data store offers simplified, rapid data access, valuable in a range of situations where instant access is necessary, for example with data caching.


Learning Redis is an example-based introduction which demonstrates how to work with the data store by creating a playable word game, written in Node.js. Fundamental topics of Redis are covered along the way.


You’ll see how simple it is to install the database on your own machine or use a database provider in the cloud. Together we will discover the basic native data types of Redis and how to use them as we write a real game using JavaScript in a Node.js environment.We’ll store and retrieve data using the Redis CLI and understand the basic NoSQL data keys and storage techniques.


Whether you’re writing a game or any other application, you need a place to store data. Learning Redis will demonstrate why you should implement Redis.


Throughout the course, we will put to use the important concepts of Redis such as keys, values, sets, and hashes, which will help us build a solid application that works on some of the most important app requirements such as information storage, validation, pub/sub, notifications, and sorting.


By the end of the course, you will understand how to make use of all of Redis’ features so you can design applications with rapid, efficiently managed data access.

Full details

Curriculum

  • Course Introduction
    The Course Overview
    Explain the requirements and the purpose of the course. • What you should already know • What you will learn • What you will do
    2:50
    The Game
    Explain the game that will be created. • An overview of the game requirements • Setting the game rules
    2:35
  • Getting Started
    Installation
    How to get Redis installed and running on your local machine. • Installing on OS X via homebrew • Installing on OS X or Linux from the source code • Installing on Windows
    6:24
    Connecting to the Remote Service
    Using a remote Redis service when a local install isn't available. • Looking at service providers • Getting set up on Redis Labs
    3:41
    The Redis CLI
    How to use Redis interactively from the command line. • Understanding the connection options for local and remote database • Verifying a connection to the database • Basic non-data commands you might use
    4:22
  • Keys and Values
    Storing and Retrieving Strings
    How to store and retrieve basic data. • Understanding the single Redis data type and using basic data access commands in the CLI • Using atomic commands to store and retrieve multiple values at a time • Using data expiration, increments, range, and bit operations.
    8:22
    Keys Instead of Indexes
    How using a key-based store affects database design and retrieval of information. • Understanding keys, namespaces, and reachability • Manipulating keys and associated data in the database • How to structure your data when you don’t have secondary indexes or SQL-like queries
    6:25
  • A Game Needs Players
    Modeling a Player
    What is a player in our game and how can we model it. • Determine what a player is by examining its purpose • What must a player entity track and how • Understanding the relationship between the game and the player
    4:43
    Creating, Storing, and Retrieving Players
    Getting started with coding the game. • Installing Node.js and the application skeleton • Setting up the configuration, connecting to Redis, and running our tests • Writing code to store and retrieve our player entity in Redis
    11:24
    Storing and Validating Passwords for Login
    Understanding good security design. • Why storing passwords in a database is never a good idea • Understanding a cryptographic hash and how to use it for passwords • Review the code that performs a password hash and compare
    4:02
  • Building a Word Dictionary
    Sets and Membership
    We need a dictionary of words to validate game plays. • Why do we need a dictionary • Understanding how a Redis set works and its basic commands Understanding the manipulation of Sets using set arithmetic
    3:34
    Making a Redis Dictionary
    Getting a dictionary of words into Redis and coding the word validation check. • Finding a set of words we can import into Redis • Importing a file full of words into a Redis set • Writing the code to validate a word and running the tests to verify it
    8:11
  • Modeling the Game
    Understanding the Game
    Understanding the game play and user interaction. • Examine how users will play the game • Break down the data access patterns • Put together a basic model of our data
    5:29
    Creating and Storing a Game w/ Game Players
    Getting the basic game stored in Redis. • Creating a unique ID and a new game object • Storing the game object in Redis as a hash • Retrieving the game from the Redis hash
    7:23
    Creating the Tile Bag
    We need a bag of tiles for the user to draw letters from. • Breaking down how the tile bag works and the letter frequency table • Using a Redis set as the tile bag and populating it • Drawing a tile and determining the number of tiles remaining
    5:46
  • Taking a Turn
    The Player's Tray
    Each player must maintain a Tray of tiles. How can we model this in Redis. • Examine what a game turn looks like for a player • Filling and refilling a player's Tray from the tile bag • Storing the Tray as a List in Redis
    9:39
    Validating a Turn
    We must validate a turn against the dictionary, the player's tray, and the previous play. • Validating the word against the dictionary • Write a function to check a play against our game rules • Write a function to get the last turn taken in a game
    9:48
    Storing the Turn in the Game
    A game is a series of turns by players that we need to manage. • Store the current player's turn in a list associated with the game • Advance the game to the next player • Allow a user to skip his or her turn
    12:07
  • Game Over and Winners
    How Does a Sorted Set Work?
    We need to understand how a sorted set works to implement a leaderboard. • Learn what a sorted set does • Learn the basic sorted set commands • Learn about using ranges in a sorted set
    7:58
    Finishing the Game
    We need to detect the end of game and mark it as complete. • Determine what constitutes "game over" • Update the saveTurn function to perform game over checks • Update the game to mark it as finished
    8:28
    Storing and Sharing the Results
    We need to calculate and store the final game results. • Review how the results will be scored • Calculate the scores of each of the players from their turns • Save and retrieve the game to the database using JSON
    4:59
    Displaying the Top 10 Players
    We want to have a leaderboard to see the top 10 scores of all time. • Add the final scores in a game to a sorted set acting as a leaderboard • Trim the size of the sorted set to only maintain the top elements • Add a function to return the top players and their scores
    9:54
  • Is It My Turn?
    Redis Events
    We need to learn how to use events to inform players about the status. • Understand the Redis Publish/Subscribe mechanism • Learn the basic pub/sub commands • Learn how to use pattern-based subscriptions
    6:19
    Modeling the Event
    We need to design an event that informs our users about the game state. • Consider communication outside of pub/sub • Determine where and how we want to communicate the game changes
    1:57
    Publishing the Event
    We need to integrate our pub/sub design into our codebase. • Write functions to publish our game events • Call the appropriate functions at the game state change locations
    10:34
    Subscribing to the Event
    We need to subscribe to the events we created. • Start a CLI utility that can "watch" a game in progress • Use pattern-matching to watch a single game or all games • Format the events so that it's easier to read on the console
    6:04
  • Wrapping Up
    What Have You Learned?
    We want to review what you have done and learned. • Review what is Redis • Review use of Redis • Review Redis data structures
    2:47
    What More Could Be Done?
    We want to explore the possibilities of what we can do. • Discuss what we didn’t cover in Redis • Discuss easy enhancements to the game • Say good night
    3:14

Skills

  • Database
  • NoSQL
  • JavaScript
  • Node.js
  • Web Application Development

Similar Courses

More Courses by this Instructor