CacheMode may be viewed as packaging a JPA-defined
CacheStoreMode with a CacheRetrieveMode. For example,
CacheMode#PUT represents the combination (BYPASS, USE).
However, this enumeration recognizes only five such combinations. In Hibernate,
CacheStoreMode#REFRESH always implies CacheRetrieveMode#BYPASS,
so there's no CacheMode representing the combination
(REFRESH, USE).
Session#setCacheMode(CacheMode), org.hibernate.query.SelectionQuery#setCacheMode(CacheMode) , CacheStoreMode, CacheRetrieveMode
| Modifier and Type | Field and Description |
|---|---|
| public static final CacheMode | GET
The session may read items from the cache, but will not add items, except to invalidate items when updates occur. |
| public static final CacheMode | IGNORE
The session will never interact with the cache, except to invalidate cached items when updates occur. |
| public static final CacheMode | NORMAL
The session may read items from the cache, and add items to the cache as it reads them from the database. |
| public static final CacheMode | PUT
The session will never read items from the cache, but will add items to the cache as it reads them from the database. |
| public static final CacheMode | |
| private final CacheRetrieveMode | |
| private final CacheStoreMode |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static CacheMode | fromJpaModes(CacheRetrieveMode retrieveMode, CacheStoreMode storeMode)
Interpret the given JPA modes as an instance of this enumeration. |
| public CacheRetrieveMode | |
| public CacheStoreMode | |
| public static CacheMode | Returns: The matching enum value.The externalized form. setting)Interpret externalized form as an instance of this enumeration. |
| public boolean | Returns: true if cache reads are allowed; false otherwise.Does this cache mode indicate that reads are allowed? |
| public boolean | Returns: true if cache writes are allowed; false otherwise.Does this cache mode indicate that writes are allowed? |
| public static CacheMode | |
| public static CacheMode[] |
| GET | back to summary |
|---|---|
| public static final CacheMode GET The session may read items from the cache, but will not add items, except to invalidate items when updates occur. | |
| IGNORE | back to summary |
|---|---|
| public static final CacheMode IGNORE The session will never interact with the cache, except to invalidate cached items when updates occur. | |
| NORMAL | back to summary |
|---|---|
| public static final CacheMode NORMAL The session may read items from the cache, and add items to the cache as it reads them from the database. | |
| PUT | back to summary |
|---|---|
| public static final CacheMode PUT The session will never read items from the cache, but will add items to the cache as it reads them from the database. In this mode, the value of the configuration setting hibernate.cache.use_minimal_puts determines whether an item is written to the cache when the cache already contains an entry with the same key. Minimal puts should be:
It's not usually necessary to specify this setting explicitly because, by default, it's set to a sensible value by the second-level cache implementation. | |
| REFRESH | back to summary |
|---|---|
| public static final CacheMode REFRESH As with to | |
| retrieveMode | back to summary |
|---|---|
| private final CacheRetrieveMode retrieveMode | |
| storeMode | back to summary |
|---|---|
| private final CacheStoreMode storeMode | |
| CacheMode | back to summary |
|---|---|
| private CacheMode(CacheStoreMode storeMode, CacheRetrieveMode retrieveMode) | |
| fromJpaModes | back to summary |
|---|---|
| public static CacheMode fromJpaModes(CacheRetrieveMode retrieveMode, CacheStoreMode storeMode) Interpret the given JPA modes as an instance of this enumeration. | |
| getJpaRetrieveMode | back to summary |
|---|---|
public CacheRetrieveMode getJpaRetrieveMode()
| |
| getJpaStoreMode | back to summary |
|---|---|
public CacheStoreMode getJpaStoreMode()
| |
| interpretExternalSetting | back to summary |
|---|---|
| public static CacheMode interpretExternalSetting(String setting) Interpret externalized form as an instance of this enumeration.
| |
| isGetEnabled | back to summary |
|---|---|
| public boolean isGetEnabled() Does this cache mode indicate that reads are allowed?
| |
| isPutEnabled | back to summary |
|---|---|
| public boolean isPutEnabled() Does this cache mode indicate that writes are allowed?
| |
| valueOf | back to summary |
|---|---|
| public static CacheMode valueOf(String name) | |
| values | back to summary |
|---|---|
| public static CacheMode[] values() | |