public long getDatabaseMaxTTL(String database) {
    CacheNode node = ttlCacheTree.searchChild(database);
    if (node == null) {
      return NULL_TTL;
    }
    Queue<CacheNode> queue = new LinkedList<>();
    queue.add(node);
    long maxTTL = node.ttl;
    while (!queue.isEmpty()) {
      CacheNode current = queue.poll();
      for (CacheNode child : current.getChildren().values()) {
        queue.add(child);
        maxTTL = Math.max(maxTTL, child.ttl);
      }
    }
    return maxTTL;
  }
Get the maximum ttl of the subtree of the corresponding database.

@param database the path of the database.
@return the maximum ttl of the subtree of the corresponding database. return NULL_TTL if the
    TTL is not set or the database does not exist.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/ttl/TTLCache.java