当前位置: 首页>>代码示例>>Java>>正文


Java Jedis.flushAll方法代码示例

本文整理汇总了Java中redis.clients.jedis.Jedis.flushAll方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.flushAll方法的具体用法?Java Jedis.flushAll怎么用?Java Jedis.flushAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.Jedis的用法示例。


在下文中一共展示了Jedis.flushAll方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public static void main(String[] args) throws UnknownHostException, IOException {
  Jedis jedis = new Jedis(hnp.getHost(), hnp.getPort());
  jedis.connect();
  jedis.auth("foobared");
  jedis.flushAll();

  long begin = Calendar.getInstance().getTimeInMillis();

  Pipeline p = jedis.pipelined();
  for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
    String key = "foo" + n;
    p.set(key, "bar" + n);
    p.get(key);
  }
  p.sync();

  long elapsed = Calendar.getInstance().getTimeInMillis() - begin;

  jedis.disconnect();

  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:23,代码来源:PipelinedGetSetBenchmark.java

示例2: main

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public static void main(String[] args) throws UnknownHostException, IOException {
  Jedis jedis = new Jedis(hnp.getHost(), hnp.getPort());
  jedis.connect();
  jedis.auth("foobared");
  jedis.flushAll();

  long begin = Calendar.getInstance().getTimeInMillis();

  for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
    String key = "foo" + n;
    jedis.set(key, "bar" + n);
    jedis.get(key);
  }

  long elapsed = Calendar.getInstance().getTimeInMillis() - begin;

  jedis.disconnect();

  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:21,代码来源:GetSetBenchmark.java

示例3: setUp

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  jedis = new Jedis(hnp.getHost(), hnp.getPort(), 500);
  jedis.connect();
  jedis.auth("foobared");
  jedis.configSet("timeout", "300");
  jedis.flushAll();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:JedisCommandTestBase.java

示例4: createJedis

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
protected Jedis createJedis() {
  Jedis j = new Jedis(hnp.getHost(), hnp.getPort());
  j.connect();
  j.auth("foobared");
  j.flushAll();
  return j;
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:JedisCommandTestBase.java

示例5: setUp

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  super.setUp();

  nj = new Jedis(hnp.getHost(), hnp.getPort(), 500);
  nj.connect();
  nj.auth("foobared");
  nj.flushAll();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:TransactionCommandsTest.java

示例6: setUp

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {

  node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort());
  node1.auth("cluster");
  node1.flushAll();

  node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort());
  node2.auth("cluster");
  node2.flushAll();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:12,代码来源:ClusterCommandsTest.java

示例7: main

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  Jedis j = new Jedis(hnp.getHost(), hnp.getPort());
  j.connect();
  j.auth("foobared");
  j.flushAll();
  j.quit();
  j.disconnect();
  long t = System.currentTimeMillis();
  // withoutPool();
  withPool();
  long elapsed = System.currentTimeMillis() - t;
  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:14,代码来源:PoolBenchmark.java

示例8: main

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Jedis j = new Jedis("127.0.0.1", 6379);
    j.connect();
    j.auth("weimob123");
    j.flushAll();
    j.quit();
    j.disconnect();
    long t = System.currentTimeMillis();
    // withoutPool();
    withPool();
    long elapsed = System.currentTimeMillis() - t;
    System.out.println(((1000 * TOTAL_OPERATIONS) / elapsed) + " ops");
}
 
开发者ID:TwoDragonLake,项目名称:tdl-seckill,代码行数:14,代码来源:PoolTest.java

示例9: flushAll

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public Void flushAll() {
  Jedis jedis = null;
  try {
    jedis = redisProvider.get();
    jedis.flushAll();
  } catch (Exception e) {
    logger.error("{}", kvp("op", "flushAll", "err", "[" + e.getMessage() + "]"), e);
  } finally {
    redisProvider.closeSafely(jedis);
  }

  return null;
}
 
开发者ID:dehora,项目名称:outland,代码行数:14,代码来源:RedisCache.java

示例10: setUp

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Before
public void setUp() throws InterruptedException {
  node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort());
  node1.auth("cluster");
  node1.flushAll();

  node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort());
  node2.auth("cluster");
  node2.flushAll();

  node3 = new Jedis(nodeInfo3.getHost(), nodeInfo3.getPort());
  node3.auth("cluster");
  node3.flushAll();

  // ---- configure cluster

  // add nodes to cluster
  node1.clusterMeet("127.0.0.1", nodeInfo2.getPort());
  node1.clusterMeet("127.0.0.1", nodeInfo3.getPort());

  // split available slots across the three nodes
  int slotsPerNode = JedisCluster.HASHSLOTS / 3;
  int[] node1Slots = new int[slotsPerNode];
  int[] node2Slots = new int[slotsPerNode + 1];
  int[] node3Slots = new int[slotsPerNode];
  for (int i = 0, slot1 = 0, slot2 = 0, slot3 = 0; i < JedisCluster.HASHSLOTS; i++) {
    if (i < slotsPerNode) {
      node1Slots[slot1++] = i;
    } else if (i > slotsPerNode * 2) {
      node3Slots[slot3++] = i;
    } else {
      node2Slots[slot2++] = i;
    }
  }

  node1.clusterAddSlots(node1Slots);
  node2.clusterAddSlots(node2Slots);
  node3.clusterAddSlots(node3Slots);

  waitForClusterReady();

  jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
  jedisCluster = new JedisCluster(jedisClusterNode, 2000, 2000, 5, "cluster", new JedisPoolConfig());

}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:46,代码来源:ClusterScriptingCommandsTest.java

示例11: setUp

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Before
public void setUp() throws InterruptedException {
  node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort());
  node1.auth("cluster");
  node1.flushAll();

  node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort());
  node2.auth("cluster");
  node2.flushAll();

  node3 = new Jedis(nodeInfo3.getHost(), nodeInfo3.getPort());
  node3.auth("cluster");
  node3.flushAll();

  node4 = new Jedis(nodeInfo4.getHost(), nodeInfo4.getPort());
  node4.auth("cluster");
  node4.flushAll();

  nodeSlave2 = new Jedis(nodeInfoSlave2.getHost(), nodeInfoSlave2.getPort());
  nodeSlave2.auth("cluster");
  nodeSlave2.flushAll();
  // ---- configure cluster

  // add nodes to cluster
  node1.clusterMeet(localHost, nodeInfo2.getPort());
  node1.clusterMeet(localHost, nodeInfo3.getPort());

  // split available slots across the three nodes
  int slotsPerNode = JedisCluster.HASHSLOTS / 3;
  int[] node1Slots = new int[slotsPerNode];
  int[] node2Slots = new int[slotsPerNode + 1];
  int[] node3Slots = new int[slotsPerNode];
  for (int i = 0, slot1 = 0, slot2 = 0, slot3 = 0; i < JedisCluster.HASHSLOTS; i++) {
    if (i < slotsPerNode) {
      node1Slots[slot1++] = i;
    } else if (i > slotsPerNode * 2) {
      node3Slots[slot3++] = i;
    } else {
      node2Slots[slot2++] = i;
    }
  }

  node1.clusterAddSlots(node1Slots);
  node2.clusterAddSlots(node2Slots);
  node3.clusterAddSlots(node3Slots);

  JedisClusterTestUtil.waitForClusterReady(node1, node2, node3);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:49,代码来源:JedisClusterTest.java


注:本文中的redis.clients.jedis.Jedis.flushAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。