From 7c3418c45926b5288b22044d60dbb12fa2c982d0 Mon Sep 17 00:00:00 2001
From: xusd <hugeinfo123>
Date: Fri, 27 Sep 2024 18:02:40 +0800
Subject: [PATCH] 大厅登记接口优化

---
 dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/GuavaCacheUtils.java |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/GuavaCacheUtils.java b/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/GuavaCacheUtils.java
index e9245c0..a475f88 100644
--- a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/GuavaCacheUtils.java
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/GuavaCacheUtils.java
@@ -13,13 +13,20 @@
  */
 public class GuavaCacheUtils {
     private static Cache<String, Object> cache = CacheBuilder.newBuilder()
-            //5分钟后过期
+            //5秒后过期
             .expireAfterWrite(5, TimeUnit.SECONDS)
 //            .expireAfterWrite(10, TimeUnit.SECONDS)
             //最大10个缓存
             .maximumSize(10)
             .build();
 
+    private static Cache<String, Object> cacheAi = CacheBuilder.newBuilder()
+            //5秒后过期
+            .expireAfterWrite(5, TimeUnit.MINUTES)
+//            .expireAfterWrite(10, TimeUnit.SECONDS)
+            //最大10个缓存
+            .maximumSize(500)
+            .build();
 
     public static Object getCache(String k) {
         return cache.getIfPresent(k);
@@ -29,6 +36,14 @@
         cache.put(k, value);
     }
 
+    public static Object getCacheAi(String k) {
+        return cacheAi.getIfPresent(k);
+    }
+
+    public static void putCacheAi(String k, Object value) {
+        cacheAi.put(k, value);
+    }
+
     public static void main(String[] args) throws InterruptedException {
         putCache("15008985673","123456");
         while (true){

--
Gitblit v1.8.0