@Component(value="eclipselink_QueryCacheManager")
public class QueryCacheManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
protected io.jmix.core.Metadata |
metadata |
protected io.jmix.core.MetadataTools |
metadataTools |
protected EclipselinkProperties |
properties |
protected QueryCache |
queryCache |
protected StoreAwareLocator |
storeAwareLocator |
Constructor and Description |
---|
QueryCacheManager() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<java.lang.String> |
getDescendants(java.util.Set<java.lang.String> relatedTypes) |
<T> java.util.List<T> |
getResultListFromCache(QueryKey queryKey,
java.util.List<io.jmix.core.FetchPlan> fetchPlans)
Get query results from query cache by specified
queryKey |
<T> T |
getSingleResultFromCache(QueryKey queryKey,
java.util.List<io.jmix.core.FetchPlan> fetchPlans)
Get single query results from query cache by specified
queryKey
If query is cached and no results found exception is thrown |
void |
invalidate(java.lang.Class typeClass)
Discards cached query results for java class (associated with metaClass)
typeClass |
void |
invalidate(java.util.Set<java.lang.String> typeNames)
Discards cached query results for metaClass names
typeNames |
void |
invalidate(java.lang.String typeName)
Discards cached query results for metaClass name
typeName |
void |
invalidateAll() |
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 . |
@Autowired protected EclipselinkProperties properties
@Autowired protected QueryCache queryCache
@Autowired protected io.jmix.core.Metadata metadata
@Autowired protected io.jmix.core.MetadataTools metadataTools
@Autowired protected StoreAwareLocator storeAwareLocator
protected static final org.slf4j.Logger log
public boolean isEnabled()
public <T> java.util.List<T> getResultListFromCache(QueryKey queryKey, java.util.List<io.jmix.core.FetchPlan> fetchPlans)
queryKey
public <T> T getSingleResultFromCache(QueryKey queryKey, java.util.List<io.jmix.core.FetchPlan> fetchPlans)
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)
typeClass
public void invalidate(java.lang.String typeName)
typeName
public void invalidate(java.util.Set<java.lang.String> typeNames)
typeNames
public void invalidateAll()
protected java.util.Set<java.lang.String> getDescendants(java.util.Set<java.lang.String> relatedTypes)