第一段:scan
SCAN 命令用于迭代当前数据库中的数据库键.
SSCAN 命令用于迭代集合键中的元素.
HSCAN 命令用于迭代哈希键中的键值对.
ZSCAN 命令用于迭代有序集合中的元素(包括元素成员和元素分值).
① 数据库基本命令
①.)扫描所有数据表
//1. 一次性获取Real_Gps中数据 Map
第二段:HashMap
public class RedisUtil { /* */ private RedisTemplate redisTemplate; /** * @param key * @param hashKey * @return */ public Object get(Object key, Object hashKey){ return redisTemplate.opsForHash().get(key, hashKey); /** * @param key * @param hashKeys * @return */ public List multiGet(Object key, Collection hashKeys){ return redisTemplate.opsForHash().multiGet(key, hashKeys); /** * @param key * @param hashKey * @param value */ public void put(Object key, Object hashKey, Object value){ /** * @param key * @param map */ public void putAll(Object key, Map map){ /** * @param key * @param hashKey * @param value * @return */ public Boolean putIfAbsent(Object key, Object hashKey, Object value){ return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value); /** * @param key * @param item * @return */ public Long delete(Object key, Object... item){ return redisTemplate.opsForHash().delete(key, item); /** * @param key * @param hashKey * @return */ public Boolean hasKey(Object key, Object hashKey){ return redisTemplate.opsForHash().hasKey(key, hashKey); /** * @param key * @return */ public Mapentries(Object key){ return redisTemplate.opsForHash().entries(key); /** * @param key * @param hashKey * @param delta * @return */ public Long increment(Object key, Object hashKey, long delta){ return redisTemplate.opsForHash().increment(key, hashKey, delta); /** * @param key * @param hashKey * @param delta * @return */ public Double increment(Object key, Object hashKey, double delta){ return redisTemplate.opsForHash().increment(key, hashKey, delta); /** * @param key * @return */ public Set keys(Object key){ return redisTemplate.opsForHash().keys(key); /** * @param key * @return */ public List values(Object key){ return redisTemplate.opsForHash().values(key); /** * @param key * @return */ public Long size(Object key){ return redisTemplate.opsForHash().size(key); } }
以上就是土嘎嘎小编为大家整理的Redis_七):RedisTemplate 操作API相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!