private static void useMSet (JRedis jredis) { // BulkSetMapping provides a set of static methods to create new specific // flavors of KeyValueSet<T> for the JRedis.mset(..) method. // use this when your values are all of the same type. // Here we are using String values KeyValueSet.Strings kvSet = BulkSetMapping.newStringKVSet(); kvSet .add("foo", "woof") .add("bar", "meow") .add("paz", "the salt") .add("x?", "yz!"); try { jredis.flushdb(); jredis.mset(kvSet); } catch (RedisException e) { e.printStackTrace(); } }