Libvalkey can replace both libraries hiredis
and hiredis-cluster
.
This guide highlights which APIs that have changed and what you need to do when migrating to libvalkey.
The general actions needed are:
- Replace the prefix
redis
withvalkey
in API usages. - Replace the term
SSL
withTLS
in API usages for secure communication. - Update include paths depending on your previous installation.
All
libvalkey
headers are now found underinclude/valkey/
. - Update used build options, e.g.
USE_TLS
replacesUSE_SSL
.
The type sds
is removed from the public API.
redisFormatSdsCommandArgv
removed from API. Can be replaced withvalkeyFormatCommandArgv
.redisFreeSdsCommand
removed since thesds
type is for internal use only.
ctx_get_by_node
is renamed tovalkeyClusterGetValkeyContext
.actx_get_by_node
is renamed tovalkeyClusterGetValkeyAsyncContext
.
redisClusterSetMaxRedirect
removed and replaced withvalkeyClusterSetOptionMaxRetry
.redisClusterSetOptionAddNode
removed and replaced withvalkeyClusterSetOptionAddNodes
.redisClusterSetOptionConnectBlock
removed since it was deprecated.redisClusterSetOptionConnectNonBlock
removed since it was deprecated.parse_cluster_nodes
removed from API, for internal use only.parse_cluster_slots
removed from API, for internal use only.
Since old days (from hiredis-vip
) there has been support for sending some commands with multiple keys that covers multiple slots.
The client would split the command into multiple commands and send to each node handling each slot.
This was unnecessary complex and broke any expectations of atomicity.
Commands affected are DEL
, EXISTS
, MGET
and MSET
.
Proposed action:
Partition the keys by slot using valkeyClusterGetSlotByKey
before sending affected commands.
Construct new commands when needed and send them using multiple calls to valkeyClusterCommand
or equivalent.