Redis SRANDMEMBER – How to get random elements from a set in redis

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get one or more random elements from a set value stored at a key. For this we will use a COMMAND – SRANDMEMBER in redis-cli. The syntax of redis SRANDMEMBER command is as follows :-  Syntax :- redis host:post> SRANDMEMBER <key name> Output :-  -(string value) Read More

Redis LLEN – How to get a length of the list in redis datastore

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get the length of a list value stored at the key. For this, we will use Redis LLEN command. LLEN Command This command returns the length ( number of elements ) of a list value stored at the key. If a key doesn’t exist in redis datastore, it Read More

Redis SADD – How to create and add elements in the set

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to create and add elements in a set value stored at the key, by using a COMMAND – SADD in redis-cli. If a key exists in the datastore, all the specified elements will be added (ignoring the elements that are already present ) to the set otherwise Read More

Redis SISMEMBER – How to check existence of an element in the set

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to check, if a specified element is a member of the set or not. For this we will use a COMMAND – SISMEMBER in redis-cli. The syntax of redis SISMEMBER command is as follows :- Syntax :- redis host:post> SISMEMBER <key name> Output :-  (integer) 1 if Read More

Redis SCARD – How to get a size of the set in redis datastore

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get the size ( number of elements ) of a set value stored at the key, by using a COMMAND – SCARD in redis-cli. The syntax of redis SCARD command is as follows :- Syntax :- redis host:post> SCARD <key name> Output :-  (integer) value, representing Read More

Redis SMEMBERS – How to get all elements of a set in redis

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get all the elements of a set value stored at the key, by using a COMMAND – SMEMBERS in redis-cli. The syntax of redis SMEMBERS command is as follows :- Syntax :- redis host:post> SMEMBERS <key name> Output :-  - array value, containing all elements of Read More

How to rename a key in redis datastore – Redis RENAME | RENAMENX

5 years ago Lalit Bhagtani 0
In this tutorial, we will learn about how to rename a key in redis datastore, by using redis RENAME and RENAMENX command. RENAME Command :- The RENAME command, rename the key from old name to new name. if a key with new name already exists, it will be overwritten and key with old name will Read More

Redis Keys – Commands to manage keys in redis datastore

5 years ago Lalit Bhagtani 0
In Redis, Keys are used as a unique identifier to store, manage and retrieved a value stored in the database. Keys can be manage by using Redis Commands in redis-cli. The syntax for using redis Key commands is as follows :- Syntax :- redis host:post> <Command Name> <key name> Example :- Redis Key Commands :-  Read More