| | |
| | | package com.ruoyi.common.core.redis;
|
| | |
|
| | | import java.util.Collection;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.data.redis.core.BoundSetOperations;
|
| | | import org.springframework.data.redis.core.HashOperations;
|
| | | import org.springframework.data.redis.core.RedisTemplate;
|
| | | import org.springframework.data.redis.core.ValueOperations;
|
| | |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit)
|
| | | {
|
| | | return redisTemplate.expire(key, timeout, unit);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取有效时间
|
| | | *
|
| | | * @param key Redis键
|
| | | * @return 有效时间
|
| | | */
|
| | | public long getExpire(final String key)
|
| | | {
|
| | | return redisTemplate.getExpire(key);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 判断 key是否存在
|
| | | *
|
| | | * @param key 键
|
| | | * @return true 存在 false不存在
|
| | | */
|
| | | public Boolean hasKey(String key)
|
| | | {
|
| | | return redisTemplate.hasKey(key);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 删除Hash中的数据
|
| | | * |
| | | * @param key
|
| | | * @param hKey
|
| | | */
|
| | | public void delCacheMapValue(final String key, final String hKey)
|
| | | {
|
| | | HashOperations hashOperations = redisTemplate.opsForHash();
|
| | | hashOperations.delete(key, hKey);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取多个Hash中的数据
|
| | | *
|
| | | * @param key Redis键
|