@@ -18,7 +18,9 @@ package org.springframework.cache.aspectj;
18
18
19
19
import org.springframework.cache.annotation.AnnotationCacheOperationSource ;
20
20
import org.springframework.cache.annotation.CacheEvict ;
21
+ import org.springframework.cache.annotation.CachePut ;
21
22
import org.springframework.cache.annotation.Cacheable ;
23
+ import org.springframework.cache.annotation.Caching ;
22
24
23
25
/**
24
26
* Concrete AspectJ cache aspect using Spring's @{@link Cacheable} annotation.
@@ -59,6 +61,20 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
59
61
private pointcut executionOfAnyPublicMethodInAtCacheEvictType () :
60
62
execution (public * ((@CacheEvict * )+ ). * (.. )) && @this (CacheEvict );
61
63
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
+
62
78
/**
63
79
* Matches the execution of any method with the @{@link Cacheable} annotation.
64
80
*/
@@ -71,15 +87,30 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
71
87
private pointcut executionOfCacheEvictMethod () :
72
88
execution (* * (.. )) && @annotation (CacheEvict );
73
89
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
+
74
102
/**
75
103
* Definition of pointcut from super aspect - matched join points will have Spring
76
104
* cache management applied.
77
105
*/
78
106
protected pointcut cacheMethodExecution (Object cachedObject ) :
79
107
(executionOfAnyPublicMethodInAtCacheableType()
80
108
|| executionOfAnyPublicMethodInAtCacheEvictType()
109
+ || executionOfAnyPublicMethodInAtCachePutType()
110
+ || executionOfAnyPublicMethodInAtCachingType()
81
111
|| executionOfCacheableMethod()
82
- || executionOfCacheEvictMethod())
112
+ || executionOfCacheEvictMethod()
113
+ || executionOfCachePutMethod()
114
+ || executionOfCachingMethod())
83
115
&& this (cachedObject);
84
-
85
- }
116
+ }
0 commit comments