private boolean hasSpaceForCacheEntry(CacheEntry entry, long size) {
    if (maxCacheSize >= 0) {
      return (cacheSize + size) <= maxCacheSize;
    }
    // Negative max cache size means unbounded.
    return true;
  }
Determines if the cache entry should be added to the results cache.
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java