public boolean updateTableColStats(List<ColumnStatisticsObj> colStatsForTable) {
      try {
        tableLock.writeLock().lock();
        int statsSize = 0;
        for (ColumnStatisticsObj colStatObj : colStatsForTable) {
          // Get old stats object if present
          String key = colStatObj.getColName();
          ColumnStatisticsObj oldStatsObj = tableColStatsCache.get(key);
          if (oldStatsObj != null) {
            // Update existing stat object's field
            statsSize -= getObjectSize(ColumnStatisticsObj.class, oldStatsObj);
            StatObjectConverter.setFieldsIntoOldStats(oldStatsObj, colStatObj);
          } else {
            // No stats exist for this key; add a new object to the cache
            // TODO: get rid of deepCopy after making sure callers don't use references
            tableColStatsCache.put(key, colStatObj.deepCopy());
          }
          statsSize += getObjectSize(ColumnStatisticsObj.class, colStatObj);
        }
        updateMemberSize(MemberName.TABLE_COL_STATS_CACHE, statsSize, SizeMode.Delta);
        setMemberCacheUpdated(MemberName.TABLE_COL_STATS_CACHE, true);
        return true;
      } finally {
        tableLock.writeLock().unlock();
      }
    }
Common method to refresh cache constraint
@param constraints list of constraints to update
@param mn Constraint type
@return Since memory constraint is handled by cache eviction policy.
Hence this method will always return true if correct constraint type passed.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java