Browse Source

Add getTargetDataSource to TransactionAwareCacheDecorator

Issue: SPR-15479
pull/1373/head
Stephane Nicoll 8 years ago
parent
commit
547c4f69a4
  1. 6
      spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java
  2. 7
      spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java

6
spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java vendored

@ -53,6 +53,12 @@ public class TransactionAwareCacheDecorator implements Cache { @@ -53,6 +53,12 @@ public class TransactionAwareCacheDecorator implements Cache {
this.targetCache = targetCache;
}
/**
* Return the target Cache that this Cache should delegate to.
*/
public Cache getTargetCache() {
return this.targetCache;
}
@Override
public String getName() {

7
spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java vendored

@ -46,6 +46,13 @@ public class TransactionAwareCacheDecoratorTests { @@ -46,6 +46,13 @@ public class TransactionAwareCacheDecoratorTests {
new TransactionAwareCacheDecorator(null);
}
@Test
public void getTargetCache() {
Cache target = new ConcurrentMapCache("testCache");
TransactionAwareCacheDecorator cache = new TransactionAwareCacheDecorator(target);
assertSame(target, cache.getTargetCache());
}
@Test
public void regularOperationsOnTarget() {
Cache target = new ConcurrentMapCache("testCache");

Loading…
Cancel
Save