新增缓存监控功能

This commit is contained in:
RuoYi
2020-11-23 10:18:58 +08:00
parent 784cc3a10f
commit 30850c1fdf
9 changed files with 406 additions and 10 deletions

View File

@ -66,6 +66,11 @@ public class Constants
* 排序的方向 "desc" 或者 "asc".
*/
public static final String IS_ASC = "isAsc";
/**
* 系统用户授权缓存
*/
public static final String SYS_AUTH_CACHE = "sys-authCache";
/**
* 参数管理 cache name

View File

@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.Set;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.utils.spring.SpringUtils;
@ -174,7 +175,7 @@ public class CacheUtils
* @param cacheName
* @return
*/
private static Cache<String, Object> getCache(String cacheName)
public static Cache<String, Object> getCache(String cacheName)
{
Cache<String, Object> cache = cacheManager.getCache(cacheName);
if (cache == null)
@ -184,4 +185,13 @@ public class CacheUtils
return cache;
}
/**
* 获取所有缓存
*
* @return 缓存组
*/
public static String[] getCacheNames()
{
return ((EhCacheManager) cacheManager).getCacheManager().getCacheNames();
}
}