赞
踩
一、数据库基本命令
1. 扫描所有数据表
scan 0
2. 扫描hash表Real_Gps中的两条记录
HSCAN Real_Gps 0 MATCH * COUNT 2
二、RedisTemplate操作scan
//1. 一次性获取Real_Gps中数据 Map<Object, Object> map1 = redisTemplate.opsForHash().entries("5555"); map1.forEach((o, o2) -> { System.out.println(o); System.out.println(o2); }); //2. 使用Scan方式遍历获取Real_Gps中的数据 ScanOptions scanOptions = ScanOptions.scanOptions().count(1).match("*").build(); Cursor<Map.Entry<Object, Object>> cursor = redisTemplate.opsForHash().scan("5555", scanOptions); while (cursor.hasNext()) { Map.Entry<Object, Object> entry = cursor.next(); entry.getKey(); entry.getValue(); System.out.println("111111" + entry.getKey()); System.out.println("222222" + entry.getValue()); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。