123456789101112131415161718192021222324252627 |
- package com.fdkankan.openApi.aop;
- import cn.hutool.cache.CacheUtil;
- import cn.hutool.cache.impl.TimedCache;
- import cn.hutool.core.date.DateUnit;
- import org.springframework.stereotype.Component;
- /**
- * @author Xiewj
- * @date 2023/2/17
- */
- @Component
- public class LocalOverCache {
- /**
- * jvm内存缓存, 并发情况,可以减少redis连接
- */
- final TimedCache<String, Boolean> timedCache = CacheUtil.newTimedCache(DateUnit.DAY.getMillis() * 1);
- public Boolean getTimedCache(String key) {
- return timedCache.get(key);
- }
- public void setTimedCache(String key, Boolean flag) {
- timedCache.put(key, flag);
- }
- }
|