Sorted Sets are often used in order to index data that is stored inside Redis. For instance if you have many hashes representing users, you can use a sorted set with elements having the age of the user as the score and the ID of the user as the value.
The topic for today is sets and hashes in Redis. These are two of the most useful data types in Redis and they’re often neglected by developers. It’s important to understand the fundamental concepts behind them because choosing the right data types helps a lot when trying to scale your application.
In this tutorial, I’m using Redis-Py to showcase the functionalities. The concept behind it is the same whichever programming language you use. Redis-Py uses the same name for function call as the original comand, with some minor exceptions. You can find the full list of the supported programming languages at the following link.
Make sure that you have Redis installed on your local machine. The local machine must consist of Linux distributions with minimal configuration settings.
You can download and compile it on your machine with the following commands (version 6.0.8 at the time of writing):
wget http://download.redis.io/releases/redis-6.0.8.tar.gz tar xzf redis-6.0.8.tar.gz cd redis-6.0.8 make
You should see a
src folder when it’s completed. Change the working directory to
Guide to Python Programming Language
Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?
Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.
Python Programming Tutorials For Beginners
Redis Lua scripting is the popularly recommended approach for handling transactions. Learn the common Lua Scripts error and how to handle for sentinel systems. Redis offers two mechanisms for handling transactions – MULTI/EXEC based transactions and Lua scripts evaluation. Redis Lua scripting is the recommended approach and is fairly popular in usage.