package com.fizz.business.service.strip;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class LogRateLimiter {
    private static final Map<String, Long> cache = new ConcurrentHashMap<>();

    public static boolean shouldLog(String key, long intervalMillis) {
        long now = System.currentTimeMillis();
        Long last = cache.get(key);
        if (last == null || now - last > intervalMillis) {
            cache.put(key, now);
            return true;
        }
        return false;
    }
}