Java Reference
In-Depth Information
Figure 8-3. The session's relationship to the caches
In practice, the four production-ready caches, which are already supported, will be ade-
quate for most users (see Table 8-4).
Table 8-4. L2 Cache Implementations Supported by Hibernate Out of the Box
Cache Name
Description
EHCache
An in-process cache
OSCache
An alternative in-process cache
SwarmCache
A multicast distributed cache
TreeCache
A multicast distributed transactional cache
The type of access to the L2 cache can be configured on a per-session basis by selecting
a CacheMode option (see Table 8-5) and applying it with the setCacheMode() method.
Table 8-5. CacheMode Options
Mode
Description
NORMAL
Data is read from and written to the cache as necessary.
GET
Data is never added to the cache (although cache entries are invalidated when
updated by the session).
PUT
Data is never read from the cache, but cache entries will be updated as they are read
from the database by the session.
REFRESH
This is the same as PUT , but the use_minimal_puts Hibernate configuration option
will be ignored if it has been set.
IGNORE
Data is never read from or written to the cache (except that cache entries will still be
invalidated when they are updated by the session).
The CacheMode setting does not affect the way in which the L1 cache is accessed.
Search WWH ::




Custom Search