support msetnx in cluster by tcc pre-check hook

This commit is contained in:
finley
2025-03-23 20:44:13 +08:00
parent 5285717a2d
commit 23b70325f9
4 changed files with 139 additions and 6 deletions

View File

@@ -79,3 +79,15 @@ func execRaftCommittedIndex(cluster *Cluster, c redis.Connection, cmdLine CmdLin
}
return protocol.MakeIntReply(int64(index))
}
// LocalExists returns existed ones from `keys` in local node
func (cluster *Cluster) LocalExists(keys []string) []string {
var exists []string
for _, key := range keys {
_, ok := cluster.db.GetEntity(0, key)
if ok {
exists = append(exists, key)
}
}
return exists
}