Class CacheUtil


  • public class CacheUtil
    extends Object
    • Constructor Detail

      • CacheUtil

        public CacheUtil()
    • Method Detail

      • computeResultLevelCacheKey

        public static Cache.NamedKey computeResultLevelCacheKey​(String resultLevelCacheIdentifier)
      • populateResultCache

        public static void populateResultCache​(Cache cache,
                                               Cache.NamedKey key,
                                               byte[] resultBytes)
      • computeSegmentCacheKey

        public static Cache.NamedKey computeSegmentCacheKey​(String segmentId,
                                                            org.apache.druid.query.SegmentDescriptor descriptor,
                                                            byte[] queryCacheKey)
      • isUseSegmentCache

        public static <T> boolean isUseSegmentCache​(org.apache.druid.query.Query<T> query,
                                                    @Nullable
                                                    org.apache.druid.query.CacheStrategy<T,​Object,​org.apache.druid.query.Query<T>> cacheStrategy,
                                                    CacheConfig cacheConfig,
                                                    CacheUtil.ServerType serverType)
        Returns whether the segment-level cache should be checked for a particular query.
        Parameters:
        query - the query to check
        cacheStrategy - result of QueryToolChest.getCacheStrategy(QueryType) on this query
        cacheConfig - current active cache config
        serverType - BROKER or DATA
      • isPopulateSegmentCache

        public static <T> boolean isPopulateSegmentCache​(org.apache.druid.query.Query<T> query,
                                                         @Nullable
                                                         org.apache.druid.query.CacheStrategy<T,​Object,​org.apache.druid.query.Query<T>> cacheStrategy,
                                                         CacheConfig cacheConfig,
                                                         CacheUtil.ServerType serverType)
        Returns whether the result-level cache should be populated for a particular query.
        Parameters:
        query - the query to check
        cacheStrategy - result of QueryToolChest.getCacheStrategy(QueryType) on this query
        cacheConfig - current active cache config
        serverType - BROKER or DATA
      • isUseResultCache

        public static <T> boolean isUseResultCache​(org.apache.druid.query.Query<T> query,
                                                   @Nullable
                                                   org.apache.druid.query.CacheStrategy<T,​Object,​org.apache.druid.query.Query<T>> cacheStrategy,
                                                   CacheConfig cacheConfig,
                                                   CacheUtil.ServerType serverType)
        Returns whether the result-level cache should be checked for a particular query.
        Parameters:
        query - the query to check
        cacheStrategy - result of QueryToolChest.getCacheStrategy(QueryType) on this query
        cacheConfig - current active cache config
        serverType - BROKER or DATA
      • isPopulateResultCache

        public static <T> boolean isPopulateResultCache​(org.apache.druid.query.Query<T> query,
                                                        @Nullable
                                                        org.apache.druid.query.CacheStrategy<T,​Object,​org.apache.druid.query.Query<T>> cacheStrategy,
                                                        CacheConfig cacheConfig,
                                                        CacheUtil.ServerType serverType)
        Returns whether the result-level cache should be populated for a particular query.
        Parameters:
        query - the query to check
        cacheStrategy - result of QueryToolChest.getCacheStrategy(QueryType) on this query
        cacheConfig - current active cache config
        serverType - BROKER or DATA