if (!cacheOrCacheRefresh) {
return !DONE;
}
QueryCache queryCache = domain.getQueryCache();
QueryCacheEntryFactory factory = getCacheObjectFactory();
if (cache) {
List cachedResults = queryCache.get(metadata, factory);
// response may already be initialized by the factory above ... it is null if
// there was a preexisting cache entry
if (response == null) {
response = new ListResponse(cachedResults);
}
if (cachedResults instanceof ListWithPrefetches) {
this.prefetchResultsByPath = ((ListWithPrefetches) cachedResults)
.getPrefetchResultsByPath();
}
}
else {
// on cache-refresh request, fetch without blocking and fill the cache
queryCache.put(metadata, (List) factory.createObject());
}
return DONE;
}