public class RedisUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static org.springframework.data.redis.core.RedisTemplate |
redisTemplate |
| 构造器和说明 |
|---|
RedisUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
decr(String key) |
static long |
decrBy(String key,
long delta)
递减
|
static Boolean |
del(String key)
del 方法
|
static boolean |
exists(String key)
exists 方法
|
static void |
expire(String key,
long expireMilliSeconds)
设值过期时间 单位小时
|
static long |
get(String key)
get 方法
|
private static org.springframework.data.redis.core.RedisTemplate |
getRedisTemplate() |
static Object |
getValue(String key)
get 方法
|
static long |
hdel(String key,
String... hashKeys)
hdel 方法
|
static boolean |
hexists(String key,
String hashKey)
hexists 方法
|
static String |
hget(String key,
String hashKey)
hget 方法
|
static Map<String,String> |
hgetAll(String key)
hgetall 方法
|
static boolean |
hsetnx(String key,
String hashKey,
String hashValue)
hsetnx 方法
|
static long |
incr(String key) |
static long |
incrBy(String key,
long delta)
递增
|
static void |
set(String key,
String value)
set 方法
|
static void |
set(String key,
String value,
long expireTime)
设值 有超时时间
|
static void |
set(String key,
String value,
long expireTime,
TimeUnit timeUnit)
设值 有超时时间
|
static boolean |
setnx(String key,
long value)
setnx 方法
|
static boolean |
setnx(String key,
String value)
setnx 方法
|
private static org.springframework.data.redis.core.RedisTemplate getRedisTemplate()
public static void expire(String key, long expireMilliSeconds)
key - expireMilliSeconds - public static boolean exists(String key)
key - public static void set(String key, String value, long expireTime)
key - value - expireTime - 单位为秒public static long get(String key)
key - public static void set(String key, String value, long expireTime, TimeUnit timeUnit)
key - value - expireTime - timeUnit - public static long decrBy(String key, long delta)
key - delta - public static long decr(String key)
public static long incrBy(String key, long delta)
key - delta - public static long incr(String key)
key - public static boolean setnx(String key, long value)
key - value - public static boolean setnx(String key, String value)
key - value - public static boolean hexists(String key, String hashKey)
key - hashKey - public static boolean hsetnx(String key, String hashKey, String hashValue)
key - hashKey - hashValue - public static long hdel(String key, String... hashKeys)
key - hashKeys - Copyright © 2021. All rights reserved.