Top Description Fields Constructors Methods
org.hibernate

public final Enum CacheMode

extends Enum<CacheMode>
Class Inheritance
Imports
java.util.Locale

Controls how the session interacts with the second-level cache and query cache.
Authors
Gavin King, Strong Liu
See Also
Session#setCacheMode(CacheMode)

Field Summary

Modifier and TypeField 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 cache items when updates occur.

private final boolean
private final boolean
public static final CacheMode
NORMAL

The session may read items from the cache, and add items to the cache.

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
REFRESH

The session will never read items from the cache, but will add items to the cache as it reads them from the database.

Constructor Summary

AccessConstructor and Description
private
CacheMode(boolean isPutEnabled, boolean isGetEnabled)

Method Summary

Modifier and TypeMethod and Description
public static CacheMode

Returns:

The matching enum value.
interpretExternalSetting
(String
The externalized form.
setting
)

Used to interpret externalized forms of this enum.

public boolean

Returns:

true if cache reads are allowed; false otherwise.
isGetEnabled
()

Does this cache mode indicate that reads are allowed?

public boolean

Returns:

true if cache writes are allowed; false otherwise.
isPutEnabled
()

Does this cache mode indicate that writes are allowed?

public static CacheMode
public static CacheMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

GETback 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.

IGNOREback to summary
public static final CacheMode IGNORE

The session will never interact with the cache, except to invalidate cache items when updates occur.

isGetEnabledback to summary
private final boolean isGetEnabled
isPutEnabledback to summary
private final boolean isPutEnabled
NORMALback to summary
public static final CacheMode NORMAL

The session may read items from the cache, and add items to the cache.

PUTback 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.

REFRESHback to summary
public static final CacheMode REFRESH

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 effect of hibernate.cache.use_minimal_puts is bypassed, in order to force a cache refresh.

Constructor Detail

CacheModeback to summary
private CacheMode(boolean isPutEnabled, boolean isGetEnabled)

Method Detail

interpretExternalSettingback to summary
public static CacheMode interpretExternalSetting(String setting)

Used to interpret externalized forms of this enum.

Parameters
setting:String

The externalized form.

Returns:CacheMode

The matching enum value.

Exceptions
MappingException:
Indicates the external form was not recognized as a valid enum value.
isGetEnabledback to summary
public boolean isGetEnabled()

Does this cache mode indicate that reads are allowed?

Returns:boolean

true if cache reads are allowed; false otherwise.

isPutEnabledback to summary
public boolean isPutEnabled()

Does this cache mode indicate that writes are allowed?

Returns:boolean

true if cache writes are allowed; false otherwise.

valueOfback to summary
public static CacheMode valueOf(String name)
valuesback to summary
public static CacheMode[] values()