1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
public static void hRemoveDim(String key, String item){
ArrayList<String> items = new ArrayList<>();
redisTemplate.execute(new RedisCallback() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { Cursor<Map.Entry<byte[], byte[]>> entryCursor = connection.hScan(key.getBytes(), ScanOptions.scanOptions().match("*" + item + "*").count(1000).build()); while(entryCursor.hasNext()){ Map.Entry<byte[], byte[]> next = entryCursor.next(); String key = new String(next.getKey()); items.add(key); } connection.close(); return null; } });
redisTemplate.opsForHash().delete(key, item) }
|