Package org.iplass.mtp.entity.query.hint
Class CacheHint
java.lang.Object
org.iplass.mtp.entity.query.hint.Hint
org.iplass.mtp.entity.query.hint.EQLHint
org.iplass.mtp.entity.query.hint.CacheHint
- All Implemented Interfaces:
java.io.Serializable,ASTNode
public class CacheHint extends EQLHint
EQLの実行結果のキャッシュを行うヒント句です。
キャッシュのスコープ、キャッシュの有効期間(秒)を指定可能です。
CahceScopeがTRANSACTIONの場合は、同一トランザクション内のみ当該キャッシュが有効です。 CahceScopeがGLOBAL(デフォルト)の場合は、共有キャッシュとなります。 CahceScope.GLOBAL、CahceScope.GLOBAL_KEEP、CahceScope.GLOBAL_RELOADの場合は、有効期間(秒)を指定することが可能です。 有効期間(秒)未指定の場合は無期限(デフォルトは無期限に設定。ただし、バックエンドで利用しているCacheStoreの設定で有効期限を設定している場合は、その限り)となります。 CacheScope.GLOBAL利用する際は、Entity定義にてqueryCacheを有効化した上で、EQLのヒント句をつける必要があります。
EQLでの記述例:
select /*+ cache */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
や、
select /*+ cache(transaction) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
や、
select /*+ cache(60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
select /*+ cache(keep, 60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
select /*+ cache(reload, 60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
CahceScopeがTRANSACTIONの場合は、同一トランザクション内のみ当該キャッシュが有効です。 CahceScopeがGLOBAL(デフォルト)の場合は、共有キャッシュとなります。 CahceScope.GLOBAL、CahceScope.GLOBAL_KEEP、CahceScope.GLOBAL_RELOADの場合は、有効期間(秒)を指定することが可能です。 有効期間(秒)未指定の場合は無期限(デフォルトは無期限に設定。ただし、バックエンドで利用しているCacheStoreの設定で有効期限を設定している場合は、その限り)となります。 CacheScope.GLOBAL利用する際は、Entity定義にてqueryCacheを有効化した上で、EQLのヒント句をつける必要があります。
EQLでの記述例:
select /*+ cache */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
や、
select /*+ cache(transaction) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
や、
select /*+ cache(60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
select /*+ cache(keep, 60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
select /*+ cache(reload, 60) */ a, b from SampleEntity where c.x='hoge' and a=1 and b=15
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCacheHint.CacheScopeキャッシュのスコープを表す列挙型です。 -
Constructor Summary
Constructors Constructor Description CacheHint()CacheHint(CacheHint.CacheScope scope)CacheHint(CacheHint.CacheScope scope, int ttl) -
Method Summary
Modifier and Type Method Description ASTNodeaccept(ASTTransformer transformer)voidaccept(HintVisitor visitor)booleanequals(java.lang.Object obj)CacheHint.CacheScopegetScope()intgetTTL()inthashCode()voidsetScope(CacheHint.CacheScope scope)キャッシュのスコープを指定。TRANSACTION or GLOBALを指定可能。 デフォルトはGLOBAL。voidsetTTL(int ttl)CacheScope.GLOBALの場合のキャッシュの有効期間(秒)を指定。 未指定、0以下の場合は無限。java.lang.StringtoString()
-
Constructor Details
-
Method Details
-
getScope
-
setScope
キャッシュのスコープを指定。TRANSACTION or GLOBALを指定可能。 デフォルトはGLOBAL。- Parameters:
scope-
-
getTTL
public int getTTL() -
setTTL
public void setTTL(int ttl)CacheScope.GLOBALの場合のキャッシュの有効期間(秒)を指定。 未指定、0以下の場合は無限。- Parameters:
ttl-
-
accept
-
accept
-
hashCode
public int hashCode() -
equals
public boolean equals(java.lang.Object obj) -
toString
public java.lang.String toString()
-