我在Spring中编写一个Web应用程序,并且使用Spring Data Redis和Jedis。 Web应用程序会谈到的Redis集群有很多的命令集” 我想将命令发送到Redis的集群中的一个管道。当我尝试,我得到了一个例外:不支持JedisCluster的流水线
的java.lang。 UnsupportedOperationException异常:管道是目前不 支持JedisClusterConnection
什么是我的另类
EDIT1:?
protected void store(Map<String,Creative> creativesToStore, Function<Map<String,Creative>,Object> executedAction)
{
this.redisTemplate.execute(
redisConnection -> executedAction.apply(creativesToStore), true, true); // Pipelined execution*/
}
protected Object storeAllCreativesRedis(Map<String,Creative> creativesToStore)
{
creativesToStore.keySet()
.stream()
.filter(key -> creativesToStore.get(key)!=null)
.forEach(key -> {
redisTemplate.opsForValue().set(key, creativesToStore.get(key), ttlSeconds, timeUnit);
logger.debug("Issuing a redis set for %s ",key);
});
return null;
}
分享你的代码,不只是例外? – alzee
您可以连接到您的密钥所在的节点并直接使用流水线。 – mp911de
您可以举例说明如何连接到群集中的单个节点吗? –