docs/content/stable/yedis/quick-start/_index.md
After creating a local cluster, follow the instructions below to test YugabyteDB's Redis-compatible YEDIS API.
redis-cli is a command line interface to interact with a Redis server. For ease of use, YugabyteDB ships with the 4.0.1 version of redis-cli in its bin directory.
Insert a key and a value.
127.0.0.1:6379> set mykey somevalue
"OK"
Query the value by the key.
127.0.0.1:6379> get mykey
"somevalue"
Check if the key exists.
127.0.0.1:6379> exists mykey
(integer) 1
If the value is a number, it can be incremented.
127.0.0.1:6379> set counter 100
"OK"
127.0.0.1:6379> incr counter
(integer) 101
127.0.0.1:6379> incr counter
(integer) 102
127.0.0.1:6379> get counter
"102"
You can create a Redis Hash data type as follows. This models the data for user id 1000 with the following attributes: {username : john, birthyear : 1977, verified : 1}.
127.0.0.1:6379> hmset user:1000 username john birthyear 1977 verified 1
"OK"
You can retrieve specific attributes for user id 1000 as follows.
127.0.0.1:6379> hget user:1000 username
"john"
127.0.0.1:6379> hget user:1000 birthyear
"1977"
You can fetch multiple attributes with a single command as follows.
127.0.0.1:6379> hmget user:1000 username birthyear no-such-field
1) "john"
2) "1977"
3) (nil)
You can fetch all attributes by using the hgetall command.
127.0.0.1:6379> hgetall user:1000
1) "birthyear"
2) "1977"
3) "username"
4) "john"
5) "verified"
6) "1"