CodisLabs/jodis

在spring中怎么配置jodis,生成RedisTemplate?

Closed this issue · 6 comments

您给了个例子:
JedisResourcePool jedisPool = RoundRobinJedisPool.create().curatorClient("192.168.80.81:19000", 6000).zkProxyDir("").build();
Jedis jedis = jedisPool.getResource();

spring中用的时候,怎么配置?
可以结合到spring-data-redis的RedisTemplate中吗?

同样问这个问题

同样问这样的问题?

我没有用过spring-data所以我也不是特别清楚。。。
我觉的按照spring一贯的做法你可能需要自己写个Factory?

是的,按照spring的一贯做法
只需要实现RedisConnectionFactory,把JedisResourcePool注入进去。按照接口返回Redis Template需要的RedisConnection就行了。

谢谢 @toruneko 解答

我在wiki里写了篇文章,spring data redis集成jodis, 返回RedisConnection时需要把pool传进去。