幻灯片 1 - Google Code

Download Report

Transcript 幻灯片 1 - Google Code

Spring Cache Module
Fondy Wang
12/7/07
红杉树(中国)信息技术有限公司公司
地址:杭州市天目山路176号西湖数源软件园11号楼3层
电话:(86)-0571-89939888
Poor Cache Usage Example
Shortages
•Code is harder to understand and the core functionality is a
lot harder to see.
•Code is harder to maintain.
•Code is harder to test.
•Code is harder to reuse
Caching method work process
• Select which methodes and data
should be cached.
• Generated cache key.
Cache-flushing method work
Process
Cache is Aspect
• AOP
• OOP
Spring Cache Module
• Provides a consistent programming model
across different caching APIs such as
EHCache, JBoss Cache, Java Caching
System (JCS) and OSCache.
• Provides a unified, simpler, easier to use,
API for programmatic use of caching
services than most of these previously
mentioned APIs.
Spring Cache Module
• Supports different strategies for
declarative caching services.
• The Caching Module may be easily
extended to support additional cache
providers.
Merits of Declarative caching
Declarative caching encapsulates how caching is performed and
eliminates any dependencies on the cache implementation from
our Java code.
•
•
•
Cleaner separation of responsibilities.
Higher modularization.
Late binding of design decisions.
Declarative caching
Declarative caching
Configuring Declarative
Caching Services
•
CacheProxyFactoryBean.