Thursday, 16 February 2017

[Redis] Set 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
package test.redis;

import redis.clients.jedis.Jedis;

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

 public RedisSetTest() {
  // 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");

  
  jedis.sadd( "set1", "1", "2", "3", "3", "4");
  System.out.println( "Set size=" + jedis.scard( "set1"));
  

  jedis.close();

 }

}

No comments:

Post a Comment