void invalidateLastCache(final @Nonnull String database) {
    readWriteLock.writeLock().lock();

    try {
      if (PathUtils.isTableModelDatabase(database)) {
        dualKeyCache.update(
            tableId -> tableId.belongTo(database),
            deviceID -> true,
            entry -> -entry.invalidateLastCache());
      } else {
        dualKeyCache.update(
            tableId ->
                Objects.isNull(tableId.getDatabase())
                    && tableId.getTableName().startsWith(database),
            deviceID -> true,
            entry -> -entry.invalidateLastCache());
        dualKeyCache.update(
            tableId ->
                Objects.isNull(tableId.getDatabase())
                    && database.startsWith(tableId.getTableName()),
            deviceID -> deviceID.matchDatabaseName(database),
            entry -> -entry.invalidateLastCache());
      }
    } finally {
      readWriteLock.writeLock().unlock();
    }
  }
Invalidate the last cache of one device.

@param database the device's database, without "root"
@param deviceId IDeviceID
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java