private Optional<byte[]> getFromCacheOrRead(
      final byte[] segmentId,
      final byte[] key,
      final ColumnFamilyHandle handle,
      final Cache<Bytes, Optional<byte[]>> cache)
      throws RocksDBException {
    final Bytes cacheKey = makeCacheKey(segmentId, key);
    Optional<byte[]> cached = cache.getIfPresent(cacheKey);
    if (cached == null) {
      final byte[] value = snapshot.get(handle, readOptions, key);
      cached = Optional.ofNullable(value);
      cache.put(cacheKey, cached);
    }
    return cached;
  }
Instantiates a new RocksDb columnar key value snapshot.

@param db the db
@param metrics the metrics
plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueSnapshot.java