private void loadFromStorage(List<Metrics> metrics) {
        final long currentTimeMillis = System.currentTimeMillis();
        try {
            List<Metrics> notInCacheMetrics =
                metrics.stream()
                       .filter(m -> {
                           final Metrics cachedValue = requireInitialization(m);
                           // the metric is tagged `not in cache`.
                           if (cachedValue == null) {
                               return true;
                           }
                           // The metric is in the cache, but still we have to check
                           // whether the cache is expired due to TTL.
                           // This is a cache-DB inconsistent case:
                           // Metrics keep coming due to traffic, but the entity in the
                           // database has been removed due to TTL.
                           if (!model.isTimeRelativeID()) {
                               // Mostly all updatable metadata level metrics are required to do this check.

                               if (metricsDAO.isExpiredCache(model, cachedValue, currentTimeMillis, metricsDataTTL)) {
                                   // The expired metrics should be removed from the context and tagged `not in cache` directly.
                                   sessionCache.remove(m);
                                   return true;
                               }
                           }

                           return false;
                       })
                       .collect(Collectors.toList());

            readMetricsCounter.inc(notInCacheMetrics.size());
            cachedMetricsCounter.inc(metrics.size() - notInCacheMetrics.size());
            if (notInCacheMetrics.isEmpty()) {
                return;
            }
            metricsDAO.multiGet(model, notInCacheMetrics).forEach(m -> {
                m.setLastUpdateTimestamp(currentTimeMillis);
                sessionCache.put(m);
            });
        } catch (final Exception e) {
            log.error("Failed to load metrics for merging", e);
        }
    }
Load data from the storage, only load data when the id doesn't exist.
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java