Repository navigation
Replies: 1 comment
|
In v5+ const nodeClient = await cluster.getNodeClientForKey(key);
await nodeClient.WATCH(key);
const value = await nodeClient.GET(key);
const reply = await nodeClient
.MULTI()
.SET(key, calculateNewValue(value))
.EXEC(); // null if `key` changed in between, so retryOn One caveat: that node client is a shared connection. If several of these transactions can run concurrently against the same node, one caller's Also, keys in a transaction must hash to the same slot, so use hash tags ( |
Uh oh!
There was an error while loading. Please reload this page.
I'm new to Redis and node-redis and have a couple questions:
RedisClusterTypehaswatchbut nounwatch- how would I unwatch a key?RedisClientType.executeIsolatedinRedisClusterType? I was originally usingcreateClientand was using this, but now that I'm usingcreateClusterI'm not sure how to watch→read→write→exec.Thanks!
All reactions