本文整理了Java中net.spy.memcached.MemcachedClient.asyncGets()
方法的一些代码示例,展示了MemcachedClient.asyncGets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MemcachedClient.asyncGets()
方法的具体详情如下:
包路径:net.spy.memcached.MemcachedClient
类名称:MemcachedClient
方法名:asyncGets
[英]Gets (with CAS support) the given key asynchronously and decode using the default transcoder.
[中]异步获取(支持CAS)给定密钥,并使用默认转码器进行解码。
代码示例来源:origin: apache/httpcomponents-client
@Override
protected Cancellable getForUpdateCAS(final String storageKey, final FutureCallback<CASValue<Object>> callback) {
return operation(client.asyncGets(storageKey), callback);
}
代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached
/**
* Gets (with CAS support) the given key asynchronously and decode using the
* default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
public OperationFuture<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: naver/arcus-java-client
/**
* Gets (with CAS support) the given key asynchronously and decode using
* the default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public Future<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached
/**
* Gets (with CAS support) the given key asynchronously and decode using
* the default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public Future<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: net.spy/spymemcached
/**
* Gets (with CAS support) the given key asynchronously and decode using the
* default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
@Override
public OperationFuture<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client
/**
* Gets (with CAS support) the given key asynchronously and decode using the
* default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
@Override
public OperationFuture<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached
/**
* Gets (with CAS support) the given key asynchronously and decode using
* the default transcoder.
*
* @param key the key to fetch
* @return a future that will hold the return value of the fetch
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public Future<CASValue<Object>> asyncGets(final String key) {
return asyncGets(key, transcoder);
}
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache
@Override
protected Cancellable getForUpdateCAS(final String storageKey, final FutureCallback<CASValue<Object>> callback) {
return operation(client.asyncGets(storageKey), callback);
}
代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached
/**
* Gets (with CAS support) with a single key.
*
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is
* exceeded
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(
operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
throw new RuntimeException("Exception waiting for value", e);
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached
/**
* Gets (with CAS support) with a single key.
*
* @param <T>
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is
* exceeded
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(
operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
throw new RuntimeException("Exception waiting for value", e);
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: naver/arcus-java-client
/**
* Gets (with CAS support) with a single key.
*
* @param <T>
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is
* exceeded
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(
operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
throw new RuntimeException("Exception waiting for value", e);
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached
/**
* Gets (with CAS support) with a single key.
*
* @param <T>
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is exceeded
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
throw new RuntimeException("Exception waiting for value", e);
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client
/**
* Gets (with CAS support) with a single key.
*
* @param <T>
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is exceeded
* @throws CancellationException if operation was canceled
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
@Override
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else {
throw new RuntimeException("Exception waiting for value", e);
}
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: net.spy/spymemcached
/**
* Gets (with CAS support) with a single key.
*
* @param <T>
* @param key the key to get
* @param tc the transcoder to serialize and unserialize value
* @return the result from the cache and CAS id (null if there is none)
* @throws OperationTimeoutException if global operation timeout is exceeded
* @throws CancellationException if operation was canceled
* @throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests
*/
@Override
public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
try {
return asyncGets(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else {
throw new RuntimeException("Exception waiting for value", e);
}
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value", e);
}
}
代码示例来源:origin: org.opensaml/opensaml-storage-impl
/**
* Looks up the namespace for the given context name in the cache.
*
* @param context Context name.
*
* @return Corresponding namespace for given context or null if no namespace exists for context.
*
* @throws java.io.IOException On memcached operation errors.
*/
protected String lookupNamespace(final String context) throws IOException {
try {
final CASValue<String> result = handleAsyncResult(
memcacheClient.asyncGets(memcachedKey(context), stringTranscoder));
return result == null ? null : result.getValue();
} catch (RuntimeException e) {
throw new IOException("Memcached operation failed", e);
}
}
代码示例来源:origin: org.opensaml/opensaml-storage-impl
memcacheClient.asyncGets(namespace + CTX_KEY_LIST_SUFFIX, stringTranscoder));
if (keys == null) {
logger.debug("No context keys found to update expiration");
memcacheClient.asyncGets(namespace + CTX_KEY_BLACKLIST_SUFFIX, stringTranscoder));
if (blacklistKeys != null) {
keySet.removeAll(Arrays.asList(blacklistKeys.getValue().split(CTX_KEY_LIST_DELIMITER)));
代码示例来源:origin: org.opensaml/opensaml-storage-impl
/** {@inheritDoc} */
@Override
public StorageRecord read(@Nonnull @NotEmpty final String context,
@Nonnull @NotEmpty final String key) throws IOException {
Constraint.isNotNull(StringSupport.trimOrNull(context), "Context cannot be null or empty");
Constraint.isNotNull(StringSupport.trimOrNull(key), "Key cannot be null or empty");
final String namespace = lookupNamespace(context);
if (namespace == null) {
logger.debug("Namespace for context {} does not exist", context);
return null;
}
final String cacheKey = memcachedKey(namespace, key);
logger.debug("Reading entry at {} for context={}, key={}", cacheKey, context, key);
final CASValue<MemcachedStorageRecord> record;
try {
record = handleAsyncResult(memcacheClient.asyncGets(cacheKey, storageRecordTranscoder));
} catch (RuntimeException e) {
throw new IOException("Memcached operation failed", e);
}
if (record == null) {
return null;
}
record.getValue().setVersion(record.getCas());
return record.getValue();
}
代码示例来源:origin: org.mybatis.caches/mybatis-memcached
Future<CASValue<Object>> future;
if (configuration.isCompressionEnabled()) {
future = client.asyncGets(keyString, new CompressorTranscoder());
} else {
future = client.asyncGets(keyString);
代码示例来源:origin: org.opensaml/opensaml-storage-impl
if (CASResponse.OK == response) {
final CASValue<MemcachedStorageRecord> newRecord = handleAsyncResult(
memcacheClient.asyncGets(cacheKey, storageRecordTranscoder));
if (newRecord != null) {
newVersion = newRecord.getCas();
内容来源于网络,如有侵权,请联系作者删除!