Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.select()


  Transaction t = jedis.multi();
  t.select(0);
  t.set("bar", "foo");

  Jedis jedis2 = createJedis();
  jedis2.select(1);
  jedis2.set("foo", "bar2");

  List<Object> results = t.exec();

  assertNull(results);
View Full Code Here


    @Test
    public void startWithUrlString() {
  Jedis j = new Jedis("localhost", 6380);
  j.auth("foobared");
  j.select(2);
  j.set("foo", "bar");
  JedisPool pool = new JedisPool("redis://:foobared@localhost:6380/2");
  Jedis jedis = pool.getResource();
  assertEquals("PONG", jedis.ping());
  assertEquals("bar", jedis.get("foo"));
View Full Code Here

    @Test
    public void startWithUrl() throws URISyntaxException {
  Jedis j = new Jedis("localhost", 6380);
  j.auth("foobared");
  j.select(2);
  j.set("foo", "bar");
  JedisPool pool = new JedisPool(new URI(
    "redis://:foobared@localhost:6380/2"));
  Jedis jedis = pool.getResource();
  assertEquals("PONG", jedis.ping());
View Full Code Here

    hnp.getPort(), 2000, "foobared");

  Jedis jedis0 = pool.getResource();
  assertEquals(0L, jedis0.getDB().longValue());

  jedis0.select(1);
  assertEquals(1L, jedis0.getDB().longValue());

  pool.returnResource(jedis0);

  Jedis jedis1 = pool.getResource();
View Full Code Here

    @Test
    public void startWithUrlString() {
  Jedis j = new Jedis("localhost", 6380);
  j.auth("foobared");
  j.select(2);
  j.set("foo", "bar");
  Jedis jedis = new Jedis("redis://:foobared@localhost:6380/2");
  assertEquals("PONG", jedis.ping());
  assertEquals("bar", jedis.get("foo"));
    }
View Full Code Here

    @Test
    public void startWithUrl() throws URISyntaxException {
  Jedis j = new Jedis("localhost", 6380);
  j.auth("foobared");
  j.select(2);
  j.set("foo", "bar");
  Jedis jedis = new Jedis(new URI("redis://:foobared@localhost:6380/2"));
  assertEquals("PONG", jedis.ping());
  assertEquals("bar", jedis.get("foo"));
    }
View Full Code Here

  protected Jedis acquireConnection() {
    Jedis jedis = connectionPool.getResource();

    if (getDatabase() != 0) {
      jedis.select(getDatabase());
    }

    return jedis;
  }
View Full Code Here

      initializeJedisConnectionPool();
    }
    Jedis jedis = redisConnectionPool.getResource();

    if (redisDatabase != 0) {
      jedis.select(redisDatabase);
    }

    return jedis;
  }
View Full Code Here

  public Row<T, String> get(final String row) throws AvroBaseException {
    try {
      boolean returned = false;
      final Jedis j = pool.getResource();
      try {
        j.select(db);
        List<Object> results;
        do {
          results = j.multi(new TransactionBlock() {
            @Override
            public void execute() throws JedisException {
View Full Code Here

  public void put(final String row, final T value) throws AvroBaseException {
    try {
      boolean returned = false;
      Jedis j = pool.getResource();
      try {
        j.select(db);
        Schema schema = value.getSchema();
        String schemaKey = hashCache.get(schema);
        if (schemaKey == null) {
          final String doc = schema.toString();
          schemaKey = createSchemaKey(schema, doc);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.