mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	add 增加 RedisUtils 工具 hasKey 检查key存在方法
This commit is contained in:
		@@ -376,4 +376,14 @@ public class RedisUtils {
 | 
			
		||||
        Iterable<String> iterable = CLIENT.getKeys().getKeysByPattern(pattern);
 | 
			
		||||
        return IterUtil.toList(iterable);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 检查redis中是否存在key
 | 
			
		||||
     *
 | 
			
		||||
     * @param key 键
 | 
			
		||||
     */
 | 
			
		||||
    public static Boolean hasKey(String key) {
 | 
			
		||||
        RKeys rKeys = CLIENT.getKeys();
 | 
			
		||||
        return rKeys.countExists(key) > 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user