Package redis.clients.jedis

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


    }

    @Test
    public void allowUrlWithNoDBAndNoPassword() {
  Jedis jedis = new Jedis("redis://localhost:6380");
  jedis.auth("foobared");
  assertEquals(jedis.getClient().getHost(), "localhost");
  assertEquals(jedis.getClient().getPort(), 6380);
  assertEquals(jedis.getDB(), (Long) 0L);

  jedis = new Jedis("redis://localhost:6380/");
View Full Code Here


  assertEquals(jedis.getClient().getHost(), "localhost");
  assertEquals(jedis.getClient().getPort(), 6380);
  assertEquals(jedis.getDB(), (Long) 0L);

  jedis = new Jedis("redis://localhost:6380/");
  jedis.auth("foobared");
  assertEquals(jedis.getClient().getHost(), "localhost");
  assertEquals(jedis.getClient().getPort(), 6380);
  assertEquals(jedis.getDB(), (Long) 0L);
    }
View Full Code Here

    private static final int TOTAL_OPERATIONS = 100000;

    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();
View Full Code Here

        if (config == null) {
            throw new IllegalArgumentException("config must not be null");
        }
        final Jedis jedis = new Jedis(config.getHost(), config.getPort(), config.getTimeout());
        if (config.getPassword() != null) {
            jedis.auth(config.getPassword());
        }
        jedis.select(config.getDatabase());
        return jedis;
    }
View Full Code Here

  public PooledObject<Jedis> makeObject() throws Exception {
    final Jedis jedis = new Jedis(this.host, this.port, this.timeout);

    jedis.connect();
    if (null != this.password) {
      jedis.auth(this.password);
    }
    if (database != 0) {
      jedis.select(database);
    }
    if (clientName != null) {
View Full Code Here

        logger.info("flushing db ..........");
        Jedis jedis = new Jedis(host, port);
        jedis.connect();
        if (password != null)
        {
            jedis.auth(password);
        }
        jedis.flushDB();
        jedis.disconnect();
    }
View Full Code Here

            String defaultPort = RedisPropertyReader.rsmd.getPort() != null ? RedisPropertyReader.rsmd.getPort()
                    : (String) props.get(PersistenceProperties.KUNDERA_PORT);
            String password = RedisPropertyReader.rsmd.getPassword() != null ? RedisPropertyReader.rsmd.getPassword()
                    : (String) props.get(PersistenceProperties.KUNDERA_PASSWORD);
            Jedis connection = new Jedis(contactNode, Integer.valueOf(defaultPort));
            connection.auth(password);
            connection.connect();
            connection.flushDB();
        }
    }
View Full Code Here

        String defaultPort = RedisPropertyReader.rsmd.getPort() != null ? RedisPropertyReader.rsmd.getPort()
                : (String) props.get(PersistenceProperties.KUNDERA_PORT);
        String password = RedisPropertyReader.rsmd.getPassword() != null ? RedisPropertyReader.rsmd.getPassword()
                : (String) props.get(PersistenceProperties.KUNDERA_PASSWORD);
        Jedis connection = new Jedis(contactNode, Integer.valueOf(defaultPort));
        connection.auth(password);
        connection.connect();
        connection.flushDB();
    }
}
View Full Code Here

            }
            Jedis connection = new Jedis(contactNode, Integer.parseInt(defaultPort));

            if (password != null)
            {
                connection.auth(password);
            }
            connection.connect();
            return connection;
        }
    }
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.