At the studio I had discussed with colleagues the possibility of using Redis, an advanced key-value storage engine, for leaderboards. In less than an hour, I had the set of Redis commands using their sorted set data type (a set of data that is sorted based on an associated “score”) to perform operations on leaderboards such as:
- Retrieving general information about a leaderboard such as total members or total pages
- Adding or removing members from a leaderboard
- Retrieving information about a member in the leaderboard such as their rank or score
- Updating score information for a member in the leaderboard
- Retrieving an arbitrary page of leaders from the leaderboard
- Retrieving the leaders around a given member in a leaderboard, also known as an “Around Me” leaderboard
- Retrieving information for an arbitrary set of members in a leaderboard, e.g. How do my friends compare against me?
Not a gamer myself, but I can see this as an exercise of using Redis and experimenting with its data types and special operations support.
Original title and link: Leaderboards using Redis: A How-To Guide (NoSQL databases © myNoSQL)