Thursday, 16 February 2017

[Redis] Scan in Java

 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package test.redis;

import java.util.List;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.ScanResult;

/*
 * ************************************************************************************
 *
 * RedisScanTest.java
 * 
 * ************************************************************************************
 * 
 * @version 1.0.00 2017-02-10 dorbae Initialize
 * @since 2017-02-10
 * @author dorbae
 * 
 * ************************************************************************************
 */
public class RedisScanTest {

 public RedisScanTest() {
  // TODO Auto-generated constructor stub
 }

 public static void main(String[] args) {
  Jedis jedis = new Jedis("btcxen.esb.broker1");
  System.out.println("Connection to server sucessfully");

  ScanResult< String> rs = jedis.scan( "0");
  List< String> list = rs.getResult();
  
  for ( int ll = 0; ll<list.size(); ll++) { 
          System.out.println("List of stored keys:: "+list.get(ll)); 
      }
  
  jedis.close();
  
 }

}

No comments:

Post a Comment