Redis - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Redis Commands

Redis Commands

shape Description

Redis key commands are used to perform some operations on redis server. To run commands on redis server you need a redis client. Redis client is available in redis package, which we have installed earlier. Redis keys commands are used for managing keys in redis. Syntax for using redis keys commands is shown below:

Redis Key Commands

shape Description

Redis key commands describes some of the basic and most common related structural data commands.
S.NO Command Description
1 Dump key This command returns a serialized version of the esteem stored at the predefined key.
2 Delete key This command deletes the key, if exists
3 Exists This command checks whether the key exists or not.
4 Expireat key timestamp Expires the key after the specified time. Here time is in Unix timestamp format
5 Expire key Expires the key after the specified time
6 Pexpireat key milliseconds-timestamp Set the expiry ofkey in unix timestamp specified as milliseconds
7 Pexpire key milliseconds Set the expiry of key in millseconds
8 Keys pattern Finds all the keys matching the specified pattern
9 Persist key Remove the expiration from the key
10 Pttl keys Get the remaining time in keys expiry in milliseconds
11 TTL key Get the remaining time in keys expiry
12 Randdomkey Return a random key from redis
13 Rename key newkey Change the key name

shape Syntax

The syntax for this types of Redis key commands is as follows:
Redis 127.0.0.1:6379>command key_name

shape Examples

The sample example for this type of Redis command is as follows: [c] redis 127.0.0.1:6379> SET SPLessons redis OK redis 127.0.0.1:6379> DEL SPLessons (integer) 1 [/c]

Summary

shape Key Points

  • Redis Commands - Are the operation that are used to perform on Redis server.
  • Redis Commands - Describes the basic and most common related structural data commands.