throw new IllegalArgumentException("The memcached get method arguments mismatch, must only one arguments. interface: " + type.getName() + ", method: " + invocation.getMethodName() + ", url: " + url); return new RpcResult(memcachedClient.get(String.valueOf(invocation.getArguments()[0]))); } else if (set.equals(invocation.getMethodName())) { if (invocation.getArguments().length != 2) {
throw new IllegalArgumentException("The memcached get method arguments mismatch, must only one arguments. interface: " + type.getName() + ", method: " + invocation.getMethodName() + ", url: " + url); return new RpcResult(memcachedClient.get(String.valueOf(invocation.getArguments()[0]))); } else if (set.equals(invocation.getMethodName())) { if (invocation.getArguments().length != 2) {
@Override public SessionData get(String sessionId) { try { return this.sessions.get(sessionId); } catch (TimeoutException | InterruptedException | MemcachedException ex) { log.error("An error occurred when get SessionData.", ex); return null; } }
/** * Get current value * * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long get() throws MemcachedException, InterruptedException, TimeoutException { Object result = this.memcachedClient.get(this.key); if (result == null) { throw new MemcachedClientException("key is not existed."); } else { if (result instanceof Long) return (Long) result; else return Long.valueOf(((String) result).trim()); } }
@Override public SessionData load(String id) throws Exception { SessionData data = _client.get(id); return data; }
@Override public Object get(final String key) throws TimeoutException, CacheException { try { return memcachedClient.get(key); } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
@Override public byte[] getBytes(String key) { try { return client.get(_key(key)); } catch (Exception e) { log.error("Failed to get data from memcached.", e); } return null; }
public List<Object> get(String queryKey) { try { return (List<Object>)client.get(keyPrefix + queryKey); } catch (Exception e) { throw new NucleusException("Exception thrown in retrieval from xmemcached", e); } }
@Override public Map<String, Object> getBulk(final Collection<String> keys) throws TimeoutException, CacheException { Map<String, Object> result = null; try { result = memcachedClient.get(keys); return (result == null) ? Collections.<String, Object> emptyMap() : result; } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
/** * Get current value * * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long get() throws MemcachedException, InterruptedException, TimeoutException { Object result = this.memcachedClient.get(this.key); if (result == null) { throw new MemcachedClientException("key is not existed."); } else { if (result instanceof Long) return (Long) result; else return Long.valueOf(((String) result).trim()); } }
@Override public <T> Map<String, T> getBulk(final Collection<String> keys, final CacheTranscoder transcoder) throws TimeoutException, CacheException { Map<String, T> result = null; try { result = memcachedClient.get(keys, this.<T> getTranscoder(transcoder)); return (result == null) ? Collections.<String, T> emptyMap() : result; } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
@Override public <T> T get(final String key, final CacheTranscoder transcoder) throws TimeoutException, CacheException { try { return memcachedClient.get(key, this.<T> getTranscoder(transcoder)); } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
public CachedPC get(Object oid) { try { return (CachedPC) client.get(getCacheKeyForId(oid)); } catch (Exception e) { throw new NucleusException("Exception thrown in retrieval from xmemcached", e); } }
@Override public <T> T get(final String key, final CacheTranscoder transcoder, final long timeout) throws TimeoutException, CacheException { try { return memcachedClient.get(key, timeout, this.<T> getTranscoder(transcoder)); } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
public byte[] get(String key) throws KeyValueStoreClientException { if (!isAlive()) { throw(new KeyValueStoreClientException(new IllegalStateException("client not established"))); } byte[] raw = null; try { raw = _client.get(key); } catch (Exception error) { throw(new KeyValueStoreClientException(error)); } return raw; }
@Override @SuppressWarnings("unchecked") public <T> T get(String key) throws IOException { notNullValue("key", key); try { if (hasNoAvailableServer()) { return null; } return (T) memcached.get(getKeyWithNamespace(key)); } catch (Exception e) { String failedMessage = "Failed to get value on memcached! (key:" + key + ")"; throw new IOException(failedMessage, e); } }
@SuppressWarnings("unchecked") @Override public <T> void setAndEnsure(String key, int secondsToExpire, T value) throws IOException { notNullValue("key", key); try { if (hasNoAvailableServer()) { return; } set(key, secondsToExpire, value); T cached = (T) memcached.get(getKeyWithNamespace(key)); if (cached == null) { String failedMessage = "Failed to set value on memcached! " + "(key:" + key + ",secondsToExpire:" + secondsToExpire + ",value:" + value + ")"; throw new IOException(failedMessage); } } catch (Exception e) { String failedMessage = "Failed to set value on memcached! " + "(key:" + key + ",secondsToExpire:" + secondsToExpire + ",value:" + value + ")"; throw new IOException(failedMessage, e); } }
throw new IllegalArgumentException("The memcached get method arguments mismatch, must only one arguments. interface: " + type.getName() + ", method: " + invocation.getMethodName() + ", url: " + url); return new RpcResult(memcachedClient.get(String.valueOf(invocation.getArguments()[0]))); } else if (set.equals(invocation.getMethodName())) { if (invocation.getArguments().length != 2) {
@Override public byte[] getValue(byte[] key) { if(client.isShutdown()){ buildClient(); } try { byte[] bytes = client. get(new String(key,"UTF-8")); return bytes; } catch (TimeoutException e) { logger.error("Failed to get cache value from memcached", e); } catch (InterruptedException e) { logger.error("Failed to get cache value from memcached", e); } catch (MemcachedException e) { logger.error("Failed to get cache value from memcached", e); } catch (UnsupportedEncodingException e) { logger.error("Failed to get cache value from memcached", e); } return null; } }
@Override public byte[] getValue(byte[] key) { if(client.isShutdown()){ buildClient(); } try { byte[] bytes = client. get(new String(key,"UTF-8")); return bytes; } catch (TimeoutException e) { logger.error("Failed to get cache value from memcached", e); } catch (InterruptedException e) { logger.error("Failed to get cache value from memcached", e); } catch (MemcachedException e) { logger.error("Failed to get cache value from memcached", e); } catch (UnsupportedEncodingException e) { logger.error("Failed to get cache value from memcached", e); } return null; } }