Phoenix
Phoenix

Reputation: 8933

What is the best way to batch get on keys in Redis Cluster in response to a batch API?

I'm using redis hashes to store metadata associated with a single key which in my case is userId. I have a batchAPI where I pass in a batch of userIds and get the metadata back. Redis Cluster doesn't support multi key commands so What's the best way to achieve this with RedisCluster? I am using Jedis as the Java Client to connect to Redis.

Upvotes: 4

Views: 5307

Answers (1)

Zsolt Katona
Zsolt Katona

Reputation: 1501

If Lettuce is an option for you, then from 4.0.Final MGET on cluster is supported:

The cluster API was extended to run a command on multiple nodes and invocation to multi-key commands DEL, MGET, MSET and MSETNX perform automatic pipelining if the keys belong to different slots/masters.

(Source: https://github.com/mp911de/lettuce/releases/tag/4.0.Final)

Upvotes: 5

Related Questions