程序包 org.hibernate
枚举 CacheMode
- java.lang.Object
-
- java.lang.Enum<CacheMode>
-
- org.hibernate.CacheMode
-
- 所有已实现的接口:
Serializable,Comparable<CacheMode>
public enum CacheMode extends Enum<CacheMode>
Controls how the session interacts with the second-level cache and query cache.- 作者:
- Gavin King, Strong Liu
- 另请参阅:
Session.setCacheMode(CacheMode)
-
-
枚举常量概要
枚举常量 枚举常量 说明 GETThe session may read items from the cache, but will not add items, except to invalidate items when updates occur.IGNOREThe session will never interact with the cache, except to invalidate cache items when updates occur.NORMALThe session may read items from the cache, and add items to the cache.PUTThe session will never read items from the cache, but will add items to the cache as it reads them from the database.REFRESHThe session will never read items from the cache, but will add items to the cache as it reads them from the database.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static CacheModeinterpretExternalSetting(String setting)Used to interpret externalized forms of this enum.booleanisGetEnabled()Does this cache mode indicate that reads are allowed?booleanisPutEnabled()Does this cache mode indicate that writes are allowed?static CacheModevalueOf(String name)返回带有指定名称的该类型的枚举常量。static CacheMode[]values()按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。
-
-
-
枚举常量详细资料
-
NORMAL
public static final CacheMode NORMAL
The session may read items from the cache, and add items to the cache.
-
IGNORE
public static final CacheMode IGNORE
The session will never interact with the cache, except to invalidate cache items when updates occur.
-
GET
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.
-
PUT
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.
-
REFRESH
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.
-
-
方法详细资料
-
values
public static CacheMode[] values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:for (CacheMode c : CacheMode.values()) System.out.println(c);
- 返回:
- 按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
-
valueOf
public static CacheMode valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- 如果该枚举类型没有带有指定名称的常量NullPointerException- 如果参数为空值
-
isGetEnabled
public boolean isGetEnabled()
Does this cache mode indicate that reads are allowed?- 返回:
trueif cache reads are allowed;falseotherwise.
-
isPutEnabled
public boolean isPutEnabled()
Does this cache mode indicate that writes are allowed?- 返回:
trueif cache writes are allowed;falseotherwise.
-
interpretExternalSetting
public static CacheMode interpretExternalSetting(String setting)
Used to interpret externalized forms of this enum.- 参数:
setting- The externalized form.- 返回:
- The matching enum value.
- 抛出:
MappingException- Indicates the external form was not recognized as a valid enum value.
-
-