Class QueryCacheManager

java.lang.Object
io.jmix.eclipselink.impl.entitycache.QueryCacheManager

@Component("eclipselink_QueryCacheManager") public class QueryCacheManager extends Object
  • Field Details

    • MAX_BATCH_SIZE

      public static final int MAX_BATCH_SIZE
      Oracle's "IN" clause parameter max count: 1000

      It is also usually exceeds cache size

      See Also:
    • properties

      @Autowired protected EclipselinkProperties properties
    • queryCache

      @Autowired protected QueryCache queryCache
    • metadata

      @Autowired protected Metadata metadata
    • metadataTools

      @Autowired protected MetadataTools metadataTools
    • storeAwareLocator

      @Autowired protected StoreAwareLocator storeAwareLocator
    • log

      protected static final org.slf4j.Logger log
  • Constructor Details

    • QueryCacheManager

      public QueryCacheManager()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Returns true if query cache enabled
    • getResultListFromCache

      public <T> List<T> getResultListFromCache(QueryKey queryKey, List<FetchPlan> fetchPlans)
      Get query results from query cache by specified queryKey
    • loadAllByIds

      protected <T> List<T> loadAllByIds(List<Object> queryCacheResult, MetaClass metaClass, List<FetchPlan> fetchPlans, JmixEntityManager em)
    • loadBatchByIds

      protected Map<Object,Object> loadBatchByIds(List<?> queryCacheResult, MetaClass metaClass, String pkName, List<FetchPlan> fetchPlans, JmixEntityManager em)
    • getSingleResultFromCache

      public <T> T getSingleResultFromCache(QueryKey queryKey, List<FetchPlan> fetchPlans)
      Get single query results from query cache by specified queryKey If query is cached and no results found exception is thrown
    • putResultToCache

      public void putResultToCache(QueryKey queryKey, List resultList, String type, Set<String> relatedTypes)
      Put query results into query cache for specified query queryKey. Results are extracted as identifiers from resultList
      Parameters:
      type - - result entity type (metaClass name)
      relatedTypes - - query dependent types (metaClass names). It's a list of entity types used in query
    • putResultToCache

      public <T> void putResultToCache(QueryKey queryKey, T result, String type, Set<String> relatedTypes, RuntimeException exception)
      Put query results into query cache for specified query queryKey. Results are extracted as identifiers from entity result
      Parameters:
      type - - result entity type (metaClass name)
      relatedTypes - - query dependent types (metaClass names). It's a list of entity types used in query
      exception - - store exception in the query cache if TypedQuery.getSingleResult() throws exception
    • invalidate

      public void invalidate(Class typeClass)
      Discards cached query results for java class (associated with metaClass) typeClass
    • invalidate

      public void invalidate(String typeName)
      Discards cached query results for metaClass name typeName
    • invalidate

      public void invalidate(Set<String> typeNames)
      Discards cached query results for metaClass names typeNames
    • invalidateAll

      public void invalidateAll()
    • getDescendants

      protected Set<String> getDescendants(Set<String> relatedTypes)