Command Comparison Chart
Below is a comprehensive chart comparing common Redis commands between ioredis and Valkey GLIDE:
Connection
Section titled “Connection”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| Connect | new Redis() | GlideClient.createClient({addresses: [{host: "localhost", port: 6379 }]}) |
| Cluster | new Redis.Cluster([]) | GlideClusterClient.createClient({addresses: [{ host: "127.0.0.1", port: 6379 }, { host: "127.0.0.1", port: 6380 }]}) |
| Auth | redis.auth('pass') | client.updateConnectionPassword('pass') |
| Select DB | redis.select(1) | client.select(1) |
Strings
Section titled “Strings”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| SET | redis.set('key', 'val') | client.set('key', 'val') |
| GET | redis.get('key') | client.get('key') |
| SETEX | redis.setex('key', 10, 'val') | client.set('key', 'val', {expiry: {type: TimeUnit.Seconds, count: 10}}) |
| SETNX | redis.setnx('key', 'val') | client.set("key", "value", {conditionalSet: "onlyIfDoesNotExist"}) |
| MSET | redis.mset({key1: 'val1'}) | client.mset({key1: 'val1'}) |
| MGET | redis.mget('key1', 'key2') | client.mget(['key1', 'key2']) |
| INCR | redis.incr('counter') | client.incr('counter') |
| DECR | redis.decr('counter') | client.decr('counter') |
| INCRBY | redis.incrby('counter', 5) | client.incrBy('counter', 5) |
| DECRBY | redis.decrby('counter', 5) | client.decrBy('counter', 5) |
| APPEND | redis.append('key', 'val') | client.append('key', 'val') |
| GETRANGE | redis.getrange('key', 0, 3) | client.getRange('key', 0, 3) |
| SETRANGE | redis.setrange('key', 0, 'val') | client.setRange('key', 0, 'val') |
| Command | ioredis | Valkey GLIDE |
|---|---|---|
| DEL | redis.del('key1', 'key2') | client.del(['key1', 'key2']) |
| EXISTS | redis.exists('key1', 'key2') | client.exists(['key1', 'key2']) |
| EXPIRE | redis.expire('key', 10) | client.expire('key', 10) |
| TTL | redis.ttl('key') | client.ttl('key') |
| KEYS | redis.keys('pattern') | client.keys('pattern') |
| SCAN | redis.scan('0') | client.scan('0') |
| RENAME | redis.rename('old', 'new') | client.rename('old', 'new') |
| RENAMENX | redis.renamenx('old', 'new') | client.renameNx('old', 'new') |
Hashes
Section titled “Hashes”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| HSET | redis.hset('hash', 'k1', 'v1', 'k2', 'v2') | client.hset('hash', {k1: 'v1', k2: 'v2'}) |
| HGET | redis.hget('hash', 'field') | client.hget('hash', 'field') |
| HMSET | redis.hmset('hash', {k1: 'v1'}) | client.hset('hash', {k1: 'v1'}) |
| HMGET | redis.hmget('hash', 'k1', 'k2') | client.hmget('hash', ['k1', 'k2']) |
| HGETALL | redis.hgetall('hash') | client.hgetall('hash') |
| HDEL | redis.hdel('hash', 'k1', 'k2') | client.hdel('hash', ['k1', 'k2']) |
| HEXISTS | redis.hexists('hash', 'field') | client.hexists('hash', 'field') |
| Command | ioredis | Valkey GLIDE |
|---|---|---|
| LPUSH | redis.lpush('list', 'a', 'b') | client.lpush('list', ['a', 'b']) |
| RPUSH | redis.rpush('list', 'a', 'b') | client.rpush('list', ['a', 'b']) |
| LPOP | redis.lpop('list') | client.lpop('list') |
| RPOP | redis.rpop('list') | client.rpop('list') |
| LRANGE | redis.lrange('list', 0, -1) | client.lrange('list', 0, -1) |
| Command | ioredis | Valkey GLIDE |
|---|---|---|
| SADD | redis.sadd('set', 'a', 'b') | client.sadd('set', ['a', 'b']) |
| SMEMBERS | redis.smembers('set') | client.smembers('set') |
| SREM | redis.srem('set', 'a', 'b') | client.srem('set', ['a', 'b']) |
| SISMEMBER | redis.sismember('set', 'a') | client.sismember('set', 'a') |
Sorted Sets
Section titled “Sorted Sets”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| ZADD | redis.zadd('zset', 1, 'a', 2, 'b') | client.zadd('zset', [{score: 1, member: 'a'}, {score: 2, member: 'b'}]) |
| ZRANGE | redis.zrange('zset', 0, -1) | client.zrange('zset', 0, -1) |
| ZRANGE with scores | redis.zrange('zset', 0, -1, 'WITHSCORES') | client.zrange('zset', 0, -1, {withScores: true}) |
| ZREM | redis.zrem('zset', 'a', 'b') | client.zrem('zset', ['a', 'b']) |
| ZSCORE | redis.zscore('zset', 'a') | client.zscore('zset', 'a') |
| ZRANK | redis.zrank('zset', 'a') | client.zrank('zset', 'a') |
| ZREVRANK | redis.zrevrank('zset', 'a') | client.zrevrank('zset', 'a') |
Transactions
Section titled “Transactions”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| MULTI/EXEC | redis.multi().set('k', 'v').get('k').exec() | client.exec(new Transaction().set('k', 'v').get('k')) |
Lua Scripts
Section titled “Lua Scripts”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| EVAL | redis.eval(script, numKeys, ...keysAndArgs) | client.invokeScript(new Script(script), {keys: [], args: []}) |
| EVALSHA | redis.evalsha(sha, numKeys, ...keysAndArgs) | client.invokeScript(new Script(script), {keys: [], args: []}) |
Custom Commands
Section titled “Custom Commands”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| Raw Command | redis.call('SET', 'key', 'value') | client.customCommand(['SET', 'key', 'value']) |
Connection Management
Section titled “Connection Management”| Command | ioredis | Valkey GLIDE |
|---|---|---|
| Close | redis.disconnect() | client.close() |