public CacheEntry addToCache(QueryInfo queryInfo, ValidTxnWriteIdList txnWriteIdList) {
    // Create placeholder entry with PENDING state.
    String queryText = queryInfo.getLookupInfo().getQueryText();
    CacheEntry addedEntry = new CacheEntry();
    addedEntry.queryInfo = queryInfo;
    addedEntry.txnWriteIdList = txnWriteIdList;

    Lock writeLock = rwLock.writeLock();
    try {
      writeLock.lock();

      LOG.info("Adding placeholder cache entry for query '{}'", queryText);

      // Add the entry to the cache structures while under write lock.
      addToEntryMap(queryMap, queryText, addedEntry);
      lru.put(addedEntry, addedEntry);
      // Index of entries by table usage.
      addedEntry.getTableNames()
          .forEach(tableName -> addToEntryMap(tableToEntryMap, tableName, addedEntry));
    } finally {
      writeLock.unlock();
    }

    return addedEntry;
  }
Add an entry to the cache.
The new entry will be in PENDING state and not usable setEntryValid() is called on the entry.
@param queryInfo
@return
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java