net.spy.memcached.MemcachedClient.asyncGetBulk()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中net.spy.memcached.MemcachedClient.asyncGetBulk()方法的一些代码示例,展示了MemcachedClient.asyncGetBulk()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MemcachedClient.asyncGetBulk()方法的具体详情如下:
包路径:net.spy.memcached.MemcachedClient
类名称:MemcachedClient
方法名:asyncGetBulk

MemcachedClient.asyncGetBulk介绍

[英]Asynchronously get a bunch of objects from the cache and decode them with the given transcoder.
[中]异步地从缓存中获取一组对象,并使用给定的转码器对它们进行解码。

代码示例

代码示例来源:origin: ninjaframework/ninja

  1. public Map<String, Object> get(String[] keys) {
  2. Future<Map<String, Object>> future = client.asyncGetBulk(tc, keys);
  3. try {
  4. return future.get(1, TimeUnit.SECONDS);
  5. } catch (Exception e) {
  6. future.cancel(false);
  7. }
  8. return Collections.<String, Object>emptyMap();
  9. }

代码示例来源:origin: apache/kylin

  1. when(memcachedClient.asyncGetBulk(keyLookup.keySet())).thenReturn(bulkFuture);
  2. when(bulkFuture.get(cacheConfig.getTimeout(), TimeUnit.MILLISECONDS)).thenReturn(bulkResult);

代码示例来源:origin: apache/httpcomponents-client

  1. @Override
  2. protected Cancellable bulkRestore(final Collection<String> storageKeys, final FutureCallback<Map<String, byte[]>> callback) {
  3. final BulkFuture<Map<String, Object>> future = client.asyncGetBulk(storageKeys);
  4. future.addListener(new BulkGetCompletionListener() {
  5. @Override
  6. public void onComplete(final BulkGetFuture<?> future) throws Exception {
  7. final Map<String, ?> storageObjectMap = future.get();
  8. final Map<String, byte[]> resultMap = new HashMap<>(storageObjectMap.size());
  9. for (final Map.Entry<String, ?> resultEntry: storageObjectMap.entrySet()) {
  10. resultMap.put(resultEntry.getKey(), castAsByteArray(resultEntry.getValue()));
  11. }
  12. callback.completed(resultMap);
  13. }
  14. });
  15. return Operations.cancellable(future);
  16. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  11. return asyncGetBulk(keys, transcoder);
  12. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them
  3. * with the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue
  8. * is too full to accept any more requests
  9. */
  10. public Future<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  11. return asyncGetBulk(keys, transcoder);
  12. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them
  3. * with the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue
  8. * is too full to accept any more requests
  9. */
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  11. return asyncGetBulk(keys, transcoder);
  12. }

代码示例来源:origin: naver/arcus-java-client

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them
  3. * with the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue
  8. * is too full to accept any more requests
  9. */
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  11. return asyncGetBulk(keys, transcoder);
  12. }

代码示例来源:origin: net.spy/spymemcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. @Override
  11. public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  12. return asyncGetBulk(keys, transcoder);
  13. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keyIter Iterator that produces the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. @Override
  11. public BulkFuture<Map<String, Object>> asyncGetBulk(
  12. Iterator<String> keyIter) {
  13. return asyncGetBulk(keyIter, transcoder);
  14. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keys the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. @Override
  11. public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
  12. return asyncGetBulk(keys, transcoder);
  13. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keyIter Iterator that produces the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(
  11. Iterator<String> keyIter) {
  12. return asyncGetBulk(keyIter, transcoder);
  13. }

代码示例来源:origin: net.spy/spymemcached

  1. /**
  2. * Asynchronously get a bunch of objects from the cache and decode them with
  3. * the given transcoder.
  4. *
  5. * @param keyIter Iterator that produces the keys to request
  6. * @return a Future result of that fetch
  7. * @throws IllegalStateException in the rare circumstance where queue is too
  8. * full to accept any more requests
  9. */
  10. @Override
  11. public BulkFuture<Map<String, Object>> asyncGetBulk(
  12. Iterator<String> keyIter) {
  13. return asyncGetBulk(keyIter, transcoder);
  14. }

代码示例来源:origin: naver/arcus-java-client

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue
  7. * is too full to accept any more requests
  8. */
  9. public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
  10. return asyncGetBulk(Arrays.asList(keys), transcoder);
  11. }

代码示例来源:origin: net.spy/spymemcached

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue is too
  7. * full to accept any more requests
  8. */
  9. @Override
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
  11. return asyncGetBulk(Arrays.asList(keys), transcoder);
  12. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue is too
  7. * full to accept any more requests
  8. */
  9. public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
  10. return asyncGetBulk(Arrays.asList(keys), transcoder);
  11. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue is too
  7. * full to accept any more requests
  8. */
  9. @Override
  10. public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
  11. return asyncGetBulk(Arrays.asList(keys), transcoder);
  12. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue
  7. * is too full to accept any more requests
  8. */
  9. public Future<Map<String, Object>> asyncGetBulk(String... keys) {
  10. return asyncGetBulk(Arrays.asList(keys), transcoder);
  11. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets with the default transcoder.
  3. *
  4. * @param keys one more more keys to get
  5. * @return the future values of those keys
  6. * @throws IllegalStateException in the rare circumstance where queue
  7. * is too full to accept any more requests
  8. */
  9. public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
  10. return asyncGetBulk(Arrays.asList(keys), transcoder);
  11. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

  1. /**
  2. * Varargs wrapper for asynchronous bulk gets.
  3. *
  4. * @param tc the transcoder to serialize and unserialize value
  5. * @param keys one more more keys to get
  6. * @return the future values of those keys
  7. * @throws IllegalStateException in the rare circumstance where queue
  8. * is too full to accept any more requests
  9. */
  10. public <T> Future<Map<String, T>> asyncGetBulk(Transcoder<T> tc,
  11. String... keys) {
  12. return asyncGetBulk(Arrays.asList(keys), tc);
  13. }

代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play

  1. @Override
  2. public Map<String, Object> get(String[] keys) {
  3. Future<Map<String, Object>> future = client.asyncGetBulk(tc, keys);
  4. try {
  5. return future.get(1, TimeUnit.SECONDS);
  6. } catch (Exception e) {
  7. future.cancel(false);
  8. }
  9. return Collections.<String, Object>emptyMap();
  10. }

相关文章