private boolean isCacheEnabledAndInitialized() {
    // Do not use the cache if session level query cache is also disabled
    // Both caches can be used only at compilation time because execution may change
    // DB objects (Tables, Partition metadata objects) and cache entries may already invalid
    SessionState sessionState = SessionState.get();
    if (sessionState == null || sessionState.getQueryCache(getQueryId()) == null) {
      return false;
    }

    return INITIALIZED.get();
  }
Checks if cache is enabled and initialized

@return boolean
ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java