DATAREDIS-246 - RedisCacheManager.getCache() does not match the logical of CompositeCacheManager.

By default RedisCacheManager lazily initializes RedisCaches when requested. To put it into static mode a defined set of cache names has to be passed to the CacheManager.

We changed the implementation so it  makes use of AbstractTransactionalCache introduced in Spring 3.2 which properly registers caches. Additionally the loadRemoteCachesOnStartup switch allows to retrieve and initialize existing caches by loading keys form redis server.

Further on RedisCacheManager can be set in transaction aware mode so that values are only put into cache after successful commit of surrounding transaction.

Original pull request: #33
This commit is contained in:
Christoph Strobl
2014-02-07 10:01:11 +01:00
committed by Thomas Darimont
parent 11f94b0810
commit 82578066e8
8 changed files with 669 additions and 29 deletions

View File

@@ -21,6 +21,11 @@
<surname>Hickey</surname>
<affiliation>SpringSource</affiliation>
</author>
<author>
<firstname>Christoph</firstname>
<surname>Strobl</surname>
<affiliation>Pivotal</affiliation>
</author>
</authorgroup>
<legalnotice>

View File

@@ -450,7 +450,7 @@
<section id="redis:support:cache-abstraction">
<title>Support for Spring Cache Abstraction</title>
<para>Spring Redis provides an implementation for Spring 3.1 <ulink url="http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/cache.html">cache abstraction</ulink>
<para>Spring Redis provides an implementation for Spring <ulink url="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html">cache abstraction</ulink>
through the <literal>org.springframework.data.redis.cache</literal> package. To use Redis as a backing implementation, simply add <literal>RedisCacheManager</literal> to your configuration:</para>
<programlisting language="xml"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -466,6 +466,13 @@
</beans>]]>
</programlisting>
<note>
By default <classname>RedisCacheManager</classname> will lazily initialize <classname>RedisCache</classname> whenever a <interfacename>Cache</interfacename> is requested. This can be changed by predefining a <interfacename>Set</interfacename> of cache names.
</note>
<note>
By default <classname>RedisCacheManager</classname> will not participate in any ongoing transaction. Use <methodname>setTransactionAware</methodname> to enable transaction support.
</note>
</section>
</section>