@Override public Table getTable(String catName, String dbName, String tblName, String validWriteIds, long tableId)
      throws MetaException {
    catName = normalizeIdentifier(Optional.ofNullable(catName).orElse(getDefaultCatalog(conf)));
    dbName = StringUtils.normalizeIdentifier(dbName);
    tblName = StringUtils.normalizeIdentifier(tblName);
    if (!shouldCacheTable(catName, dbName, tblName) || (canUseEvents && rawStore.isActiveTransaction())) {
      return rawStore.getTable(catName, dbName, tblName, validWriteIds);
    }
    Table tbl = sharedCache.getTableFromCache(catName, dbName, tblName);

    if (tbl == null) {
      // This table is not yet loaded in cache
      // If the prewarm thread is working on this table's database,
      // let's move this table to the top of tblNamesBeingPrewarmed stack,
      // so that it gets loaded to the cache faster and is available for subsequent requests
      tblsPendingPrewarm.prioritizeTableForPrewarm(tblName);
      Table t = rawStore.getTable(catName, dbName, tblName, validWriteIds);
      if (t != null) {
        sharedCache.addTableToCache(catName, dbName, tblName, t);
      }
      return t;
    }
    if (validWriteIds != null) {
      tbl.setParameters(
          adjustStatsParamsForGet(tbl.getParameters(), tbl.getParameters(), tbl.getWriteId(), validWriteIds));
    }

    tbl.unsetPrivileges();
    tbl.setRewriteEnabled(tbl.isRewriteEnabled());
    if (tbl.getPartitionKeys() == null) {
      // getTable call from ObjectStore returns an empty list
      tbl.setPartitionKeys(new ArrayList<>());
    }
    String tableType = tbl.getTableType();
    if (tableType == null) {
      // for backwards compatibility with old metastore persistence
      if (tbl.getViewOriginalText() != null) {
        tableType = TableType.VIRTUAL_VIEW.toString();
      } else if ("TRUE".equals(tbl.getParameters().get("EXTERNAL"))) {
        tableType = TableType.EXTERNAL_TABLE.toString();
      } else {
        tableType = TableType.MANAGED_TABLE.toString();
      }
    }
    tbl.setTableType(tableType);
    return tbl;
  }
This starts a background thread, which initially populates the SharedCache and later
periodically gets updates from the metastore db

@param conf
@param runOnlyOnce
@param shouldRunPrewarm
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java