public void removeConstraintFromCache(String catName, String dbName, String tblName, String constraintName) {
    try {
      cacheLock.readLock().lock();
      TableWrapper tblWrapper = tableCache.getIfPresent(CacheUtils.buildTableKey(catName, dbName, tblName));
      if ((tblWrapper != null) && tblWrapper.isConstraintsValid()) {
        // Because lake of snapshot freshness validation.
        // For now disabling cached constraint snapshot deletion in parts by invalidating constraint snapshot.
        tblWrapper.invalidateConstraintsCache();
      }
    } finally {
      cacheLock.readLock().unlock();
    }
  }
Replaces the old db object with the new one. This will add the new database to cache if it does
not exist.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java