Compatibility

Relay is designed to be a drop-in replacement for PhpRedis.

Compatibility mode

PhpRedis will return false in the event that a key doesn’t exist, but also if there is an error. This makes it hard to distinguish the two return values.

$redis = new Redis;
$redis->get('i-do-not-exist'); // false

Relay however will return null if a key doesn’t exist, and will throw an exception if there is an error.

$relay = new Relay;
$relay->get('i-do-not-exist'); // null

To change Relay’s behavior, you may enable it’s compatibility mode.

$relay = new Relay;
$relay->setOption(Relay::OPT_PHPREDIS_COMPATIBILITY, true);
$relay->get('i-do-not-exist'); // false

Commands

The table below provides an overview of which commands aresupported, enhanced or simply proxied.

  • Compatible commands work just like in PhpRedis
  • Enhanced commands work just like in PhpRedis, with additional in-memory processing
  • Proxied commands are send to Redis as is and their API might differ from PhpRedis
Command Compatible Enhanced Proxied
APPEND
AUTH
BGREWRITEAOF
BGSAVE
BITCOUNT
BITFIELD
BITOP
BITPOS
BLPOP
BRPOP
BRPOPLPUSH
BLMOVE
BZPOPMIN
BZPOPMAX
COMMAND
COPY
DBSIZE
DEBUG OBJECT
DEBUG SEGFAULT
DECR
DECRBY
DEL
DISCARD
DUMP
ECHO
EVAL
EVALSHA
EXEC
EXISTS 🚀
EXPIRE
EXPIREAT
FAILOVER
FLUSHALL
FLUSHDB
GEOADD
GEOHASH
GEOPOS
GEODIST
GEORADIUS
GEORADIUSBYMEMBER
GEOSEARCH
GEOSEARCHSTORE
GET 🚀
GETBIT 🚀
GETDEL
GETEX
GETRANGE 🚀
GETSET
HDEL
HELLO ✔️
HEXISTS 🚀
HGET 🚀
HGETALL 🚀
HINCRBY
HINCRBYFLOAT
HKEYS 🚀
HLEN 🚀
HMGET 🚀
HMSET
HSET
HSETNX
HRANDFIELD
HSTRLEN 🚀
HVALS 🚀
INCR
INCRBY
INCRBYFLOAT
INFO
KEYS
LASTSAVE
LINDEX
LINSERT
LLEN 🚀
LPOP
LPOS
LPUSH
LPUSHX
LRANGE 🚀
LREM
LSET
LTRIM
MGET 🚀
MIGRATE
MOVE
MSET
MSETNX
MULTI
OBJECT
PERSIST
PEXPIRE
PEXPIREAT
PFADD
PFCOUNT
PFMERGE
PING
PSETEX
PSUBSCRIBE
PUBSUB
PTTL
PUBLISH
PUNSUBSCRIBE
RANDOMKEY
RENAME
RENAMENX
RESET
RESTORE
ROLE
RPOP
RPOPLPUSH
LMOVE
RPUSH
RPUSHX
SADD
SAVE
SCARD 🚀
SCRIPT
SDIFF
SDIFFSTORE
SELECT
SET
SETBIT
SETEX
SETNX
SETRANGE
SINTER
SINTERSTORE
SISMEMBER 🚀
SMISMEMBER 🚀
SMEMBERS 🚀
SMOVE
SORT
SPOP
SRANDMEMBER
SREM
STRALGO
STRLEN 🚀
SUBSCRIBE
SUNION
SUNIONSTORE
TIME
TOUCH
TTL
TYPE
UNSUBSCRIBE
UNLINK
UNWATCH
WAIT
WATCH
ZADD
ZCARD
ZCOUNT
ZDIFF
ZDIFFSTORE
ZINCRBY
ZINTER
ZINTERSTORE
ZLEXCOUNT
ZPOPMAX
ZPOPMIN
ZRANDMEMBER
ZRANGESTORE
ZRANGE
ZRANGEBYLEX
ZREVRANGEBYLEX
ZRANGEBYSCORE
ZRANK
ZREM
ZREMRANGEBYLEX
ZREMRANGEBYRANK
ZREMRANGEBYSCORE
ZREVRANGE
ZREVRANGEBYSCORE
ZREVRANK
ZSCORE
ZUNION
ZMSCORE
ZUNIONSTORE
SCAN
SSCAN
HSCAN
ZSCAN
XINFO
XADD
XTRIM
XDEL
XRANGE
XREVRANGE
XLEN
XREAD
XGROUP
XREADGROUP
XACK
XCLAIM
XAUTOCLAIM
XPENDING