I am using redis as my spring cache implementation. And the official doc says we should configure the cache manager like this:
<!-- Old version -->
<bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"
c:template-ref="redisTemplate">
And it works fine when version of jedis = 2.0.0 and version of spring-data-redis = 1.0.2.RELEASE.
But in more recent versions (e.g. jedis = 2.5.2 and spring-data-redis = 1.3.4.RELEASE), the config above is not working. Instead, it throws the an exception, saying "loadCaches must not return an empty Collection". Then I referred to it and googled it again, and now the configuration file is something like this:
<!-- New Version -->
<bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"
c:template-ref="redisTemplate">
<property name="cacheNames">
<map>
<bean id="someid" class="someclass" p:name="somename"/>
</map>
</property>
</bean>
Now it doesn't complain about empty collection, but something else about initialization.
So there are another 2 questions here:
- Inside the cacheNames property, I see others are using "list", "set" and "map". What are the differences?
- How to configure the bean inside?
I have been struggling with this bean setup for a couple of days.. Could you please help me on them? Thanks in advance