Redis list rightPushAll 与leftPushAll 区别:rightPushAll 保持原数组的顺序 leftPushAll 倒序
List subList 左闭右开原则 [0-5)
Hash key:map
Key |
Value | hashKey | key2Value | HashKey2 | KeyValue |
Redis 存数据格式与API 取决于 你想怎么取出。与取出保持一致
Redis 批量化操作:
gridsTemplate.executePipelined((RedisCallback<Object>) connection -> {gridsMap.forEach((mmsi, grids) -> {if (!CollectionUtils.isEmpty(grids.getGridList())) {connection.set(keyCreator.getKey(mmsi).getBytes(), grids.toByteArray(), expiration,SetOption.UPSERT);}});return null;});
List<Object> result = gridsTemplate.executePipelined((RedisCallback<Object>) connection -> {keys.forEach(key -> connection.get(key.getBytes(StandardCharsets.UTF_8)));return null;});if (CollectionUtils.isEmpty(result)) {return Collections.emptyMap();}
与multGet 区别:
multGet redisMainTemplate.opsForValue().multiGet(list)
List key 集合大小不能超过一定阈值 会超时
文章转载自纯洁的明依,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




