Merge pull request #473 from metamx/fix-caching-npe

fix npe in CachingQueryRunner
This commit is contained in:
fjy 2014-04-09 18:06:47 -06:00
commit 35c89d29a0
1 changed files with 10 additions and 5 deletions

View File

@ -84,11 +84,16 @@ public class CachingQueryRunner<T> implements QueryRunner<T>
&& strategy != null && strategy != null
&& cacheConfig.isPopulateCache(); && cacheConfig.isPopulateCache();
final Cache.NamedKey key = CacheUtil.computeSegmentCacheKey( final Cache.NamedKey key;
if(strategy != null && (useCache || populateCache)) {
key = CacheUtil.computeSegmentCacheKey(
segmentIdentifier, segmentIdentifier,
segmentDescriptor, segmentDescriptor,
strategy.computeCacheKey(query) strategy.computeCacheKey(query)
); );
} else {
key = null;
}
if(useCache) { if(useCache) {
final Function cacheFn = strategy.pullFromCache(); final Function cacheFn = strategy.pullFromCache();