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

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

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

MemcachedClient.flush介绍

[英]Flush all caches from all servers immediately.
[中]立即刷新所有服务器上的所有缓存。

代码示例

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

  1. public void clear() {
  2. client.flush();
  3. }

代码示例来源:origin: qiujiayu/AutoLoadCache

  1. @Override
  2. public void delete(Set<CacheKeyTO> keys) throws CacheCenterConnectionException {
  3. if (null == memcachedClient || null == keys || keys.isEmpty()) {
  4. return;
  5. }
  6. String hfield;
  7. for (CacheKeyTO cacheKeyTO : keys) {
  8. if (null == cacheKeyTO) {
  9. continue;
  10. }
  11. String cacheKey = cacheKeyTO.getCacheKey();
  12. if (null == cacheKey || cacheKey.isEmpty()) {
  13. continue;
  14. }
  15. hfield = cacheKeyTO.getHfield();
  16. if (null != hfield && hfield.length() > 0) {
  17. throw new RuntimeException("memcached does not support hash cache.");
  18. }
  19. try {
  20. String allKeysPattern = "*";
  21. if (allKeysPattern.equals(cacheKey)) {
  22. memcachedClient.flush();
  23. } else {
  24. memcachedClient.delete(cacheKey);
  25. }
  26. } catch (Exception e) {
  27. log.error(e.getMessage(), e);
  28. }
  29. }
  30. }

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

  1. @Override
  2. public void clear() {
  3. client.flush();
  4. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. *
  4. * @return whether or not the operation was performed
  5. * @throws IllegalStateException in the rare circumstance where queue is too
  6. * full to accept any more requests
  7. */
  8. @Override
  9. public OperationFuture<Boolean> flush() {
  10. return flush(-1);
  11. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. *
  4. * @return whether or not the operation was performed
  5. * @throws IllegalStateException in the rare circumstance where queue
  6. * is too full to accept any more requests
  7. */
  8. public Future<Boolean> flush() {
  9. return flush(-1);
  10. }

代码示例来源:origin: org.osgl/osgl-cache

  1. @Override
  2. public void clear() {
  3. client.flush();
  4. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. *
  4. * @return whether or not the operation was performed
  5. * @throws IllegalStateException in the rare circumstance where queue is too
  6. * full to accept any more requests
  7. */
  8. public OperationFuture<Boolean> flush() {
  9. return flush(-1);
  10. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. *
  4. * @return whether or not the operation was performed
  5. * @throws IllegalStateException in the rare circumstance where queue is too
  6. * full to accept any more requests
  7. */
  8. @Override
  9. public OperationFuture<Boolean> flush() {
  10. return flush(-1);
  11. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. * @return whether or not the operation was performed
  4. * @throws IllegalStateException in the rare circumstance where queue
  5. * is too full to accept any more requests
  6. */
  7. public Future<Boolean> flush() {
  8. return flush(-1);
  9. }

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

  1. /**
  2. * Flush all caches from all servers immediately.
  3. * @throws IllegalStateException in the rare circumstance where queue
  4. * is too full to accept any more requests
  5. */
  6. public Future<Boolean> flush() {
  7. return flush(-1);
  8. }

代码示例来源:origin: org.datanucleus/datanucleus-cache

  1. public void evictAll()
  2. {
  3. client.flush();
  4. }

代码示例来源:origin: yahoo/fili

  1. @Override
  2. public void clear() {
  3. client.flush();
  4. }
  5. }

代码示例来源:origin: caskdata/coopr

  1. @Override
  2. public void wipe() throws IOException {
  3. client.flush();
  4. }

代码示例来源:origin: org.datanucleus/datanucleus-cache

  1. public void evictAll()
  2. {
  3. client.flush();
  4. }

代码示例来源:origin: rpatil26/webutilities

  1. @Override
  2. public void invalidateAll() {
  3. client.flush();
  4. }

代码示例来源:origin: org.datanucleus/datanucleus-cache

  1. public void close()
  2. {
  3. if (clearAtClose)
  4. {
  5. client.flush();
  6. client.shutdown();
  7. }
  8. }

代码示例来源:origin: rpatil26/webutilities

  1. @Override
  2. public void cleanup() {
  3. client.flush();
  4. client.shutdown();
  5. client = null;
  6. }
  7. }

代码示例来源:origin: io.snappydata/gemfire-junit

  1. public void testFlush() throws Exception {
  2. MemcachedClient client = bootstrapClient();
  3. Future<Boolean> b = client.flush();
  4. assertTrue(b.get());
  5. assertNull(client.get("key"));
  6. assertNull(client.get("key1"));
  7. }

代码示例来源:origin: io.snappydata/gemfire-junit

  1. public void testFlushDelay() throws Exception {
  2. MemcachedClient client = bootstrapClient();
  3. Future<Boolean> b = client.flush(5);
  4. assertTrue(b.get());
  5. assertNotNull(client.get("key"));
  6. assertNotNull(client.get("key1"));
  7. Thread.sleep(8*1000);
  8. assertNull(client.get("key"));
  9. assertNull(client.get("key1"));
  10. }

代码示例来源:origin: aurorafeint/jruby-memcached

  1. @JRubyMethod
  2. public IRubyObject flush(ThreadContext context) {
  3. Ruby ruby = context.getRuntime();
  4. try {
  5. client.flush().get();
  6. return context.nil;
  7. } catch (OperationTimeoutException e) {
  8. throw Error.newATimeoutOccurred(ruby, e.getLocalizedMessage());
  9. } catch (ExecutionException e) {
  10. throw ruby.newRuntimeError(e.getLocalizedMessage());
  11. } catch (InterruptedException e) {
  12. throw ruby.newThreadError(e.getLocalizedMessage());
  13. }
  14. }

相关文章