w3resource

Redis Keys: TYPE

TYPE key

Redis TYPE command is used to get the data type of value stored in the key.

Syntax:

TYPE KEY_NAME 

Available since

1.0.0.

Return Value

String reply, data type of value stored in the key or none

Return Value Type

Integer

Example: Redis TYPE

First, create some keys in redis and set some values in it.

127.0.0.1:6379> SET STR "JavaScript"
OK
127.0.0.1:6379> TYPE STR
string
127.0.0.1:6379> lpush list JAVA
(integer) 1
127.0.0.1:6379> TYPE list
list
127.0.0.1:6379> SADD set Python
(integer) 1
127.0.0.1:6379> TYPE set
set
127.0.0.1:6379> HSET hash 0 MySQL
(integer) 1
127.0.0.1:6379> TYPE hash
hash

Now check the type of key.

Previous: TTL
Next: WAIT



Follow us on Facebook and Twitter for latest update.