Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
b7f9bf2e
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b7f9bf2e
编写于
11月 16, 2011
作者:
C
Chris Beams
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish cache Javadoc
上级
8abb3150
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
43 deletion
+34
-43
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AbstractCacheAspect.aj
.../org/springframework/cache/aspectj/AbstractCacheAspect.aj
+10
-17
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AnnotationCacheAspect.aj
...rg/springframework/cache/aspectj/AnnotationCacheAspect.aj
+24
-26
未找到文件。
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AbstractCacheAspect.aj
浏览文件 @
b7f9bf2e
...
...
@@ -16,28 +16,23 @@
package
org
.
springframework
.
cache
.
aspectj
;
import
java
.
lang
.
reflect
.
InvocationTargetException
;
import
java
.
lang
.
reflect
.
Method
;
import
java
.
util
.
concurrent
.
Callable
;
import
org
.
aspectj
.
lang
.
annotation
.
SuppressAjWarnings
;
import
org
.
aspectj
.
lang
.
reflect
.
MethodSignature
;
import
org
.
springframework
.
cache
.
interceptor
.
CacheAspectSupport
;
import
org
.
springframework
.
cache
.
interceptor
.
CacheOperationSource
;
import
org
.
springframework
.
cache
.
interceptor
.
CacheAspectSupport
.
Invoker
;
/**
*
Abstract
superaspect
for
AspectJ
cache
aspects
.
Concrete
*
subaspects
will
implement
the
<
code
>
cacheMethodExecution
()</
code
>
*
pointcut
using
a
strategy
such
as
Java
5
annotations
.
*
Abstract
superaspect
for
AspectJ
cache
aspects
.
Concrete
subaspects
will
implement
the
*
{@
link
#
cacheMethodExecution
}
pointcut
using
a
strategy
such
as
Java
5
annotations
.
*
*
<
p
>
Suitable
for
use
inside
or
outside
the
Spring
IoC
container
.
*
Set
the
"cacheManager"
property
appropriately
,
allowing
*
use
of
any
cache
implementation
supported
by
Spring
.
*
<
p
>
Suitable
for
use
inside
or
outside
the
Spring
IoC
container
.
Set
the
*
{@
link
#
setCacheManager
cacheManager
}
property
appropriately
,
allowing
use
of
any
cache
*
implementation
supported
by
Spring
.
*
*
<
p
><
b
>
NB
:</
b
>
If
a
method
implements
an
interface
that
is
itself
*
cache
annotated
,
the
relevant
Spring
cache
definition
*
will
<
i
>
not
</
i
>
be
resolved
.
*
<
p
><
b
>
NB
:</
b
>
If
a
method
implements
an
interface
that
is
itself
cache
annotated
,
the
*
relevant
Spring
cache
definition
will
<
i
>
not
</
i
>
be
resolved
.
*
*
@
author
Costin
Leau
*
@
since
3.1
...
...
@@ -49,8 +44,8 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
/**
*
Construct
object
using
the
given
caching
metadata
retrieval
strategy
.
*
@
param
cos
{@
link
CacheOperationSource
}
implementation
,
retrieving
Spring
*
cache
metadata
for
each
joinpoint
.
*
@
param
cos
{@
link
CacheOperationSource
}
implementation
,
retrieving
Spring
cache
*
metadata
for
each
joinpoint
.
*/
protected
AbstractCacheAspect
(
CacheOperationSource
...
cos
)
{
setCacheOperationSources
(
cos
);
...
...
@@ -71,9 +66,7 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
}
/**
*
Concrete
subaspects
must
implement
this
pointcut
,
to
identify
*
cached
methods
.
For
each
selected
joinpoint
,
{@
link
CacheOperationDefinition
}
*
will
be
retrieved
using
Spring
's {@link CacheOperationSource} interface.
*
Concrete
subaspects
must
implement
this
pointcut
,
to
identify
cached
methods
.
*/
protected
abstract
pointcut
cacheMethodExecution
(
Object
cachedObject
);
...
...
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AnnotationCacheAspect.aj
浏览文件 @
b7f9bf2e
...
...
@@ -21,21 +21,20 @@ import org.springframework.cache.annotation.CacheEvict;
import
org
.
springframework
.
cache
.
annotation
.
Cacheable
;
/**
*
Concrete
AspectJ
cache
aspect
using
Spring
's {@link Cacheable} annotation.
*
Concrete
AspectJ
cache
aspect
using
Spring
's
@
{@link Cacheable} annotation.
*
* <p>When using this aspect, you <i>must</i> annotate the implementation class
*
(and/or methods within that class), <i>not</i> the interface (if any) that
*
the class implements. AspectJ follows Java'
s
rule
that
annotations
on
*
in
terfaces
are
<
i
>
not
</
i
>
in
herited
.
* <p>When using this aspect, you <i>must</i> annotate the implementation class
(and/or
*
methods within that class), <i>not</i> the interface (if any) that the class
*
implements. AspectJ follows Java'
s
rule
that
annotations
on
interfaces
are
<
i
>
not
</
i
>
*
inherited
.
*
*
<
p
>
A
{@
link
Cacheable
}
annotation
on
a
class
specifies
the
default
caching
*
semantics
for
the
execution
of
any
<
b
>
public
</
b
>
operation
in
the
class
.
*
<
p
>
A
{@
code
@
Cacheable
}
annotation
on
a
class
specifies
the
default
caching
semantics
*
for
the
execution
of
any
<
b
>
public
</
b
>
operation
in
the
class
.
*
*
<
p
>
A
{@
link
Cacheable
}
annotation
on
a
method
within
the
class
overrides
the
*
default
caching
semantics
given
by
the
class
annotation
(
if
present
).
*
Any
method
may
be
annotated
(
regardless
of
visibility
).
*
Annotating
non
-
public
methods
directly
is
the
only
way
*
to
get
caching
demarcation
for
the
execution
of
such
operations
.
*
<
p
>
A
{@
code
@
Cacheable
}
annotation
on
a
method
within
the
class
overrides
the
default
*
caching
semantics
given
by
the
class
annotation
(
if
present
).
Any
method
may
be
*
annotated
(
regardless
of
visibility
).
Annotating
non
-
public
methods
directly
is
the
*
only
way
to
get
caching
demarcation
for
the
execution
of
such
operations
.
*
*
@
author
Costin
Leau
*
@
since
3.1
...
...
@@ -47,41 +46,40 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
}
/**
*
Matches
the
execution
of
any
public
method
in
a
type
with
the
*
{@
link
Cacheable
}
annotation
,
or
any
subtype
of
a
type
with
the
*
{@
link
Cacheable
}
annotation
.
*
Matches
the
execution
of
any
public
method
in
a
type
with
the
@{@
link
Cacheable
}
*
annotation
,
or
any
subtype
of
a
type
with
the
{@
code
@
Cacheable
}
annotation
.
*/
private
pointcut
executionOfAnyPublicMethodInAtCacheableType
()
:
execution
(
public
*
((@
Cacheable
*)+).*(..))
&&
@
this
(
Cacheable
);
/**
*
Matches
the
execution
of
any
public
method
in
a
type
with
the
*
{@
link
CacheEvict
}
annotation
,
or
any
subtype
of
a
type
with
the
*
{@
link
CacheEvict
}
annotation
.
*
Matches
the
execution
of
any
public
method
in
a
type
with
the
@{@
link
CacheEvict
}
*
annotation
,
or
any
subtype
of
a
type
with
the
{@
code
CacheEvict
}
annotation
.
*/
private
pointcut
executionOfAnyPublicMethodInAtCacheEvictType
()
:
execution
(
public
*
((@
CacheEvict
*)+).*(..))
&&
@
this
(
CacheEvict
);
/**
*
Matches
the
execution
of
any
method
with
the
*
Cacheable
annotation
.
*
Matches
the
execution
of
any
method
with
the
@{@
link
Cacheable
}
annotation
.
*/
private
pointcut
executionOfCacheableMethod
()
:
execution
(*
*(..))
&&
@
annotation
(
Cacheable
);
/**
*
Matches
the
execution
of
any
method
with
the
{@
link
CacheEvict
}
annotation
.
*
Matches
the
execution
of
any
method
with
the
@
{@
link
CacheEvict
}
annotation
.
*/
private
pointcut
executionOfCacheEvictMethod
()
:
execution
(*
*(..))
&&
@
annotation
(
CacheEvict
);
/**
*
Definition
of
pointcut
from
super
aspect
-
matched
join
points
*
will
have
Spring
cache
management
applied
.
*
Definition
of
pointcut
from
super
aspect
-
matched
join
points
will
have
Spring
*
cache
management
applied
.
*/
protected
pointcut
cacheMethodExecution
(
Object
cachedObject
)
:
(
executionOfAnyPublicMethodInAtCacheableType
()
||
executionOfAnyPublicMethodInAtCacheEvictType
()
||
executionOfCacheableMethod
()
||
executionOfCacheEvictMethod
())
&&
this
(
cachedObject
);
(
executionOfAnyPublicMethodInAtCacheableType
()
||
executionOfAnyPublicMethodInAtCacheEvictType
()
||
executionOfCacheableMethod
()
||
executionOfCacheEvictMethod
())
&&
this
(
cachedObject
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录