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

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

本文整理了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

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

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

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

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

@Override
protected Cancellable bulkRestore(final Collection<String> storageKeys, final FutureCallback<Map<String, byte[]>> callback) {
  final BulkFuture<Map<String, Object>> future = client.asyncGetBulk(storageKeys);
  future.addListener(new BulkGetCompletionListener() {
    @Override
    public void onComplete(final BulkGetFuture<?> future) throws Exception {
      final Map<String, ?> storageObjectMap = future.get();
      final Map<String, byte[]> resultMap = new HashMap<>(storageObjectMap.size());
      for (final Map.Entry<String, ?> resultEntry: storageObjectMap.entrySet()) {
        resultMap.put(resultEntry.getKey(), castAsByteArray(resultEntry.getValue()));
      }
      callback.completed(resultMap);
    }
  });
  return Operations.cancellable(future);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章