class FinalizedStateCache {

  public Optional<BeaconState> getFinalizedState(final UInt64 slot) {
    try {
      return Optional.of(stateCache.getUnchecked(slot));
    } catch (final UncheckedExecutionException e) {
      if (Throwables.getRootCause(e) instanceof StateUnavailableException) {
        return Optional.empty();
      }
      throw new RuntimeException("Error while regenerating state", e);
    }
  }

  public  FinalizedStateCache(
      final Database database, final int maximumCacheSize, final boolean useSoftReferences);

}