Cache

李建奇

2007-2-9

大致的情況。

第一章 Hibernate + ehCache

l???????? Hibernate cache 與 一般cache 的不同點:

??? ??? Hibernate cache 沒有失真。

?

l???????? ??? QueryCache 基本無效,除非是對基本不變的字典表

參見:

19.4. The Query Cache

??? one holding cached query result sets? ( org.hibernate.cache.StandardQueryCache ), the other holding timestamps of the most recent updates to queryable tables ( org.hibernate.cache.UpdateTimestampsCache )

?

?

l???????? Hibernate Cache jointFetch

? 如果 joint item 沒有被 cache? 可能導(dǎo)致 n+1 查詢。

?

第二章 SpringAop+EhCache:

??? 特點:失真。所以,不能對有實時要求的業(yè)務(wù)做。

第三章 EhCache 代碼分析

Proxy pattern :? hibernate cache

Observer pattern : event register.

Strategy pattern : memStore

Singleton : cacheManager

Factory pattern: listenFactory

第四章 建議的 Cache 策略

?

1.???? 使用 基本的 hibernate model cache

2.???? 對字典表使用 queryCache

3.???? 對必要的service 使用 cache intercept



西津渡