package com.cameleer.server.app.alerting.eval;

import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;

public class TickCache {

    private final ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();

    @SuppressWarnings("unchecked")
    public <T> T getOrCompute(String key, Supplier<T> supplier) {
        return (T) map.computeIfAbsent(key, k -> supplier.get());
    }
}
