Skip to content

Commit d10f225

Browse files
author
Costin Leau
committed
+ update aspectj cache aspects
+ update integration tests
1 parent 1e2f491 commit d10f225

File tree

7 files changed

+717
-30
lines changed

7 files changed

+717
-30
lines changed

org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AnnotationCacheAspect.aj

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package org.springframework.cache.aspectj;
1818

1919
import org.springframework.cache.annotation.AnnotationCacheOperationSource;
2020
import org.springframework.cache.annotation.CacheEvict;
21+
import org.springframework.cache.annotation.CachePut;
2122
import org.springframework.cache.annotation.Cacheable;
23+
import org.springframework.cache.annotation.Caching;
2224

2325
/**
2426
* Concrete AspectJ cache aspect using Spring's @{@link Cacheable} annotation.
@@ -59,6 +61,20 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
5961
private pointcut executionOfAnyPublicMethodInAtCacheEvictType() :
6062
execution(public * ((@CacheEvict *)+).*(..)) && @this(CacheEvict);
6163

64+
/**
65+
* Matches the execution of any public method in a type with the @{@link CachePut}
66+
* annotation, or any subtype of a type with the {@code CachePut} annotation.
67+
*/
68+
private pointcut executionOfAnyPublicMethodInAtCachePutType() :
69+
execution(public * ((@CachePut *)+).*(..)) && @this(CachePut);
70+
71+
/**
72+
* Matches the execution of any public method in a type with the @{@link Caching}
73+
* annotation, or any subtype of a type with the {@code Caching} annotation.
74+
*/
75+
private pointcut executionOfAnyPublicMethodInAtCachingType() :
76+
execution(public * ((@Caching *)+).*(..)) && @this(Caching);
77+
6278
/**
6379
* Matches the execution of any method with the @{@link Cacheable} annotation.
6480
*/
@@ -71,15 +87,30 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
7187
private pointcut executionOfCacheEvictMethod() :
7288
execution(* *(..)) && @annotation(CacheEvict);
7389

90+
/**
91+
* Matches the execution of any method with the @{@link CachePut} annotation.
92+
*/
93+
private pointcut executionOfCachePutMethod() :
94+
execution(* *(..)) && @annotation(CachePut);
95+
96+
/**
97+
* Matches the execution of any method with the @{@link Caching} annotation.
98+
*/
99+
private pointcut executionOfCachingMethod() :
100+
execution(* *(..)) && @annotation(Caching);
101+
74102
/**
75103
* Definition of pointcut from super aspect - matched join points will have Spring
76104
* cache management applied.
77105
*/
78106
protected pointcut cacheMethodExecution(Object cachedObject) :
79107
(executionOfAnyPublicMethodInAtCacheableType()
80108
|| executionOfAnyPublicMethodInAtCacheEvictType()
109+
|| executionOfAnyPublicMethodInAtCachePutType()
110+
|| executionOfAnyPublicMethodInAtCachingType()
81111
|| executionOfCacheableMethod()
82-
|| executionOfCacheEvictMethod())
112+
|| executionOfCacheEvictMethod()
113+
|| executionOfCachePutMethod()
114+
|| executionOfCachingMethod())
83115
&& this(cachedObject);
84-
85-
}
116+
}

0 commit comments

Comments
 (0)