public void cacheConsensusSample(
      TConsensusGroupId regionGroupId, ConsensusGroupHeartbeatSample sample) {
    // Only cache sample when the corresponding loadCache exists
    Optional.ofNullable(consensusGroupCacheMap.get(regionGroupId))
        .ifPresent(group -> group.cacheHeartbeatSample(sample));
  }
Cache the latest leader of a RegionGroup.

@param regionGroupId the id of the RegionGroup
@param sample the latest heartbeat sample
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java