Package Com.alex.xiyoubang;
Import Java.util.Set;
Import Redis.clients.jedis.Jedis;
public class Jedisset {static Jedis Jedis = new Jedis ("192.168.1.171", 6379);
public static void Main (string[] args) {System.out.println ("==set==");
Emptying Data System.out.println (JEDIS.FLUSHDB ());
Jedis.sadd ("Xiyoubang", "Tang Priest");
Jedis.sadd ("Xiyoubang", "Goku");
Jedis.sadd ("Xiyoubang", "Wu Energy");
Jedis.sadd ("Xiyoubang", "Wu Jing");
set<string> setvalues = jedis.smembers ("Xiyoubang");
System.out.println (setvalues);
Returns the number of elements in the collection System.out.println (Jedis.scard ("Xiyoubang"));
Determine if the net is a Xiyoubang set of elements System.out.println (Jedis.sismember ("Xiyoubang", "Wu Net"));
Get all the added value System.out.println (jedis.smembers ("Xiyoubang"));
Out Stack System.out.println (Jedis.spop ("Xiyoubang"));
Removal of Noname Jedis.srem ("Xiyoubang", "Wu Jing"); SystEm.out.println (Jedis.scard ("Xiyoubang"));
System.out.println (Jedis.sismember ("Xiyoubang", "Wu Jing"));
System.out.println (Jedis.smembers ("Xiyoubang"));
Jedis.sadd ("Sets1", "HashSet1");
Jedis.sadd ("Sets1", "SortedSet1");
Jedis.sadd ("Sets1", "TreeSet");
Jedis.sadd ("Sets2", "HashSet2");
Jedis.sadd ("Sets2", "SortedSet1");
Jedis.sadd ("Sets2", "TreeSet1");
Intersection System.out.println (Jedis.sinter ("Sets1", "sets2"));
and set System.out.println (Jedis.sunion ("Sets1", "sets2"));
Difference Set SYSTEM.OUT.PRINTLN (Jedis.sdiff ("Sets1", "sets2"));
}
}
Set detailed description: http://blog.csdn.net/qq_32347977/article/details/50510546