YEDIS API reference

YEDIS API reference

Introduction

The YEDIS API provides a clustered, auto-sharded, globally distributed and persistent key-value API that is compatible with the Redis commands library. A Redis client can connect, send requests, and receive results from YugabyteDB.

Data types

The following data types can be read and written via the YEDIS API.

Data type Development status
String Supported
Hash Supported
Set Supported
Sorted set Supported
List Not yet supported
Bitmaps Not yet supported
HyperLogLogs Not yet supported
GeoSpatial Not yet supported
Time series New data type in YugabyteDB

Commands

Redis-cli or any Redis applications can access YugabyteDB using the YEDIS API. The following Redis commands are accepted.

Command Description
String data type
APPEND Append data to end of string
DEL Delete keys from a database
EXISTS Check if the keys are present
EXPIRE Set key timeout in seconds
EXPIREAT Set key timeout as timestamp
SET Write or overwrite a string value
SETEX Write or overwrite a string value and set TTL in seconds
PSETEX Write or overwrite a string value and set TTL in milliseconds
SETRANGE Write a subsection of a string
GET Read string value
GETRANGE Read substring
GETSET Atomically read and write a string
INCR Increment the value by one
KEYS Retrieve all keys matching a pattern
PEXPIRE Set key timeout in milliseconds
PEXPIREAT Set key timeout as timestamp in milliseconds
PTTL Get time to live for key in milliseconds
TTL Get time to live for key in seconds
Hash data type
HDEL Remove specified entries from a hash
HEXISTS Check if the subkeys are present in the hash
HGET Read a field in hash
HGETALL Read all the contents in a hash
HKEYS Read all value-keys in a hash
HLEN Get the number of entries in a hash
HMGET Read values for the given keys in a hash
HMSET Write values for the given keys in a hash
HSET Write one entry in a hash
HSTRLEN Read the length of a specified entry in a hash
HVALS Read all values in a hash
Set data type
SADD Add entries to a set
SCARD Read the number of entries in a set
SISMEMBER Check if the members are present in a set
SMEMBERS Read all members of a set
SREM Remove members from a set
STRLEN Read the length of a string
Time series data type
TSADD Add a time series entry
TSCARD Retrieve the number of elements in the given time series
TSGET Retrieve a time series entry
TSLASTN Retrieve the latest N time series entries for a given time series
TSRANGEBYTIME Retrieve time series entries for a given time range
TSREM Delete a time series entry
TSREVRANGEBYTIME Retrieve time series entries for a given time range ordered from newest to oldest
Sorted set data type
ZADD Add a sorted set entry
ZCARD Get cardinality of a sorted set
ZRANGE Retrieve sorted set entries for given index range
ZRANGEBYSCORE Retrieve sorted set entries for a given score range
ZREM Delete a sorted set entry
ZREVRANGE Retrieve sorted set entries for given index range ordered from highest to lowest score
ZSCORE Get the score of member at a sorted set key
General
AUTH Authenticates a client connection to YEDIS API
CONFIG Not fully supported. Only used to set the required password(s) for YEDIS API
ECHO Output messages
MONITOR Debugging tool to see all requests that are processed by a YEDIS API server
ROLE Read role of a node
RENAME Rename one key as another
Database
FLUSHALL Delete all keys from all databases
FLUSHDB Delete all keys from a database
CREATEDB Create a new yedis database
LISTDB List all the yedis databases present
DELETEDB Delete a yedis database
SELECT Select the target database to communcate with
Pub-Sub
PUBSUB Used to query the state of the Pub/Sub system.
PUBLISH Publishes a message to the specified channel
SUBSCRIBE Subscribes the client to the specified channel(s)
PSUBSCRIBE Subscribes the client to the specified pattern(s)
UNSUBSCRIBE Unubscribes the client from the specified channel(s)
PUNSUBSCRIBE Unubscribes the client from the specified pattern(s)