public void clear() {
    Lock writeLock = rwLock.writeLock();
    try {
      writeLock.lock();
      LOG.info("Clearing the results cache");
      CacheEntry[] allEntries = null;
      synchronized (lru) {
        allEntries = lru.keySet().toArray(EMPTY_CACHEENTRY_ARRAY);
      }
      for (CacheEntry entry : allEntries) {
        try {
          removeEntry(entry);
        } catch (Exception err) {
          LOG.error("Error removing cache entry " + entry, err);
        }
      }
    } finally {
      writeLock.unlock();
    }
  }
Updates a pending cache entry with a FetchWork result from a finished query.
If successful the cache entry will be set to valid status and be usable for cached queries.
Important: Adding the entry to the cache will increment the reader count for the cache entry.
CacheEntry.releaseReader() should be called when the caller is done with the cache entry.
@param cacheEntry
@param fetchWork
@return
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java