Introduction to Redis
In the previous chapter, we discovered how to create a competitive roll bot that allows users to play a "Who can roll the highest" game. Although it worked admirably, the feature sorely missing is a leaderboard of sorts, where each user's wins and losses are stored and an overall winners list is kept.
Such a feature wouldn't be difficult to produce; however, the largest problem comes in storing the data. Any data stored in JavaScript variables would be lost once the program ends or crashes. A better solution would then be to maintain a persistent database, which our bot can write to and read from.
There is a wide variety of database services to choose from; you might already be familiar with MySQL or MongoDB. For the example bots in this chapter, we will pick a service that is easy to set up and simple to use.
The database service we will use is Redis: http://redis.io/.
The Redis website describes the technology as follows:
"Redis is an open source (BSD licensed), in-memory...