package cn.reghao.bnt.web.admin.service;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.stats.CacheStats;
import org.springframework.stereotype.Service;

/**
 * @author reghao
 * @date 2025-09-23 17:34:18
 */
@Service
public class CacheService {
    private final Cache<String, Object> caffeineCache;

    public CacheService(Cache<String, Object> caffeineCache) {
        this.caffeineCache = caffeineCache;
    }

    public void getStat() {
        CacheStats stats = caffeineCache.stats();
        double hitRate = stats.hitRate();
        long evictCount = stats.evictionCount();
        double loadPenalty = stats.averageLoadPenalty();
    }
}
