public void testMset() throws ExecutionException, InterruptedException { Map<String, Integer> map = new HashMap<String, Integer>(); map.put("MAP_KEY1", 1); map.put("MAP_KEY2", 2); String result = client.msetInt(map).get(); assertEquals("OK", result); int cached = client.getInt("MAP_KEY1").get(); assertEquals(1, cached); }
public void testMget() throws ExecutionException, InterruptedException { Map<String, String> map = new HashMap<String, String>(); map.put("MAPMX_KEY1", "TES"); map.put("MAPMX_KEY2", "EST"); client.msetObjectNx(map).get(); List<String> result = (List<String>) client.mget(new String[] {"MAPMX_KEY1", "MAPMX_KEY2", "NON_EXIST"}).get(); assertEquals("TES", result.get(0)); assertEquals("EST", result.get(1)); assertEquals(null, result.get(2)); Map<String, Integer> map2 = new HashMap<String, Integer>(); map2.put("MAP_KEY1", 1); map2.put("MAP_KEY2", 2); String resultStr = client.msetInt(map2).get(); assertEquals("OK", resultStr); List<Integer> cached = client.mgetInt(new String[] {"MAP_KEY1", "MAP_KEY2"}).get(); assertEquals(2, cached.size()); assertEquals(1, cached.get(0).intValue()); assertEquals(2, cached.get(1).intValue()); }