/** * @throws Exception If failed. */ @Test public void testGetBulk() throws Exception { jcache().put("getKey1", "getVal1"); jcache().put("getKey2", "getVal2"); jcache().put("getKey3", "getVal3"); Map<String, Object> map = client.getBulk("getKey1", "getKey2"); info("Map: " + map); Assert.assertEquals(2, map.size()); Assert.assertEquals("getVal1", map.get("getKey1")); Assert.assertEquals("getVal2", map.get("getKey2")); }
@Override public Map<String, Object> getBulk(final Collection<String> keys) throws TimeoutException, CacheException { try { return memcachedClient.getBulk(keys); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while getBulk {}", keys, e); throw (TimeoutException) e.getCause(); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public Map<String, Object> getBulk(final Collection<String> keys) throws TimeoutException, CacheException { try { return memcachedClient.getBulk(keys); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while getBulk {}", keys, e); throw (TimeoutException) e.getCause(); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public <T> Map<String, T> getBulk(final Collection<String> keys, final CacheTranscoder transcoder) throws TimeoutException, CacheException { try { return memcachedClient.getBulk(keys, this.<T> getTranscoder(transcoder)); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while getBulk {}", keys, e); throw (TimeoutException) e.getCause(); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public <T> Map<String, T> getBulk(final Collection<String> keys, final CacheTranscoder transcoder) throws TimeoutException, CacheException { try { return memcachedClient.getBulk(keys, this.<T> getTranscoder(transcoder)); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while getBulk {}", keys, e); throw (TimeoutException) e.getCause(); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }