引言
了解Jedis的童鞋可能清楚,Jedis中JedisCluster
是不支持pipeline操作的,如果使用了redis集群,在spring-boot-starter-data-redis
中又正好用到的pipeline,那么会接收到Pipeline is currently not supported for JedisClusterConnection.
这样的报错。错误来自于org.springframework.data.redis.connection.jedis.JedisClusterConnection
:
/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.RedisConnection#openPipeline()
*/
@Override
public void openPipeline() {
throw new UnsupportedOperationException("Pipeline is currently not supported for JedisClusterConnection.");
}
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
会帮我们自动配置,无论你redis使用的是standalone、sentinel、cluster配置。这个源码很容易理解,读者可自行阅读,不理解的可以一起讨论。