@Component(value="cuba_QueryCacheManager")
public class QueryCacheManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Constructor and Description |
---|
QueryCacheManager() |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<T> |
getResultListFromCache(QueryKey queryKey,
java.util.List<View> views)
Get query results from query cache by specified
queryKey |
<T> T |
getSingleResultFromCache(QueryKey queryKey,
java.util.List<View> views)
Get single query results from query cache by specified
queryKey
If query is cached and no results found exception is thrown |
void |
init() |
void |
invalidate(java.lang.Class typeClass,
boolean sendInCluster)
Discards cached query results for java class (associated with metaClass)
typeClass |
void |
invalidate(java.util.Set<java.lang.String> typeNames,
boolean sendInCluster)
Discards cached query results for metaClass names
typeNames |
void |
invalidate(java.lang.String typeName,
boolean sendInCluster)
Discards cached query results for metaClass name
typeName |
void |
invalidate(java.util.UUID queryId,
boolean sendInCluster)
Discards cached query results for query identifier
queryId |
void |
invalidateAll(boolean sendInCluster)
Discards all query results in the cache.
|
boolean |
isEnabled()
Returns true if query cache enabled
|
void |
putResultToCache(QueryKey queryKey,
java.util.List resultList,
java.lang.String type,
java.util.Set<java.lang.String> relatedTypes)
Put query results into query cache for specified query
queryKey . |
<T> void |
putResultToCache(QueryKey queryKey,
T result,
java.lang.String type,
java.util.Set<java.lang.String> relatedTypes,
java.lang.RuntimeException exception)
Put query results into query cache for specified query
queryKey . |
public static final java.lang.String NAME
@PostConstruct public void init()
public boolean isEnabled()
public <T> java.util.List<T> getResultListFromCache(QueryKey queryKey, java.util.List<View> views)
queryKey
public <T> T getSingleResultFromCache(QueryKey queryKey, java.util.List<View> views)
queryKey
If query is cached and no results found exception is thrownpublic void putResultToCache(QueryKey queryKey, java.util.List resultList, java.lang.String type, java.util.Set<java.lang.String> relatedTypes)
queryKey
.
Results are extracted as identifiers from resultList
type
- - result entity type (metaClass name)relatedTypes
- - query dependent types (metaClass names). It's a list of entity types used in querypublic <T> void putResultToCache(QueryKey queryKey, T result, java.lang.String type, java.util.Set<java.lang.String> relatedTypes, java.lang.RuntimeException exception)
queryKey
.
Results are extracted as identifiers from entity result
type
- - result entity type (metaClass name)relatedTypes
- - query dependent types (metaClass names). It's a list of entity types used in queryexception
- - store exception in the query cache if TypedQuery.getSingleResult()
throws exceptionpublic void invalidate(java.lang.Class typeClass, boolean sendInCluster)
typeClass
sendInCluster
- - if true - discard queries results in all query caches in clusterpublic void invalidate(java.lang.String typeName, boolean sendInCluster)
typeName
sendInCluster
- - if true - discard queries results in all query caches in clusterpublic void invalidate(java.util.Set<java.lang.String> typeNames, boolean sendInCluster)
typeNames
sendInCluster
- - if true - discard queries results in all query caches in clusterpublic void invalidate(java.util.UUID queryId, boolean sendInCluster)
queryId
sendInCluster
- - if true - discard queries results in all query caches in clusterpublic void invalidateAll(boolean sendInCluster)
sendInCluster
- - if true - discard queries results in all query caches in cluster