Package org.jredis.connector

Examples of org.jredis.connector.ConnectionSpec


      fail("In suite setup for random address <"+hostName+">", e);
    }
    return address;
  }
  static public ConnectionSpec getConnectionSpecFor (InetAddress address, int port, int db) {
    ConnectionSpec connSpec = DefaultConnectionSpec.newSpec().setAddress(address).setPort(port).setDatabase(db);
    return connSpec;
  }
View Full Code Here


  @Test
  public void testIdentityContract () {
    Log.log("Testing ClusterNodeSpec identity contract enforcement: [Object.equals() | Object.hashCode()]");
    int db = 10;
    int anotherDb = 2;
    ConnectionSpec node1Spec = DefaultConnectionSpec.newSpec("127.0.0.1", 6379, db, null);
    ConnectionSpec node2Spec = DefaultConnectionSpec.newSpec("127.0.0.1", 6379, db, null);
    ConnectionSpec node3Spec = DefaultConnectionSpec.newSpec("127.0.0.1", 6379, anotherDb, null);
   
    ClusterNodeSpec node1 = newProviderInstance(node1Spec);
    ClusterNodeSpec node2 = newProviderInstance(node2Spec);
    ClusterNodeSpec node3 = newProviderInstance(node3Spec);
   
View Full Code Here

   * Don't forget to flush db#11 after running this as it adds a whole bunch of keys.
   * @param args
   */
  public static void main (String[] args) {
    int database = 11;
    ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec("localhost", 6379, database, "jredis".getBytes());
    int connCnt = 7;
    int userCnt = 10;
    int opsCnt = 100000;
   
    // create the service -- well this is it as far as usage goes:  set the number of connections for the service pool
View Full Code Here

 
  /**
   * Using the synchronous interface
   */
  public static void usingSyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedis jredis = new JRedisClient(spec);

View Full Code Here

 
  /**
   * Using the asynchronous interface
   */
  public static void usingAsyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedisFuture jredis = new JRedisAsynchClient(spec);

View Full Code Here

public class UsingJRedisPipelineService {

  final JRedis jredis;
  private UsingJRedisPipelineService() {
    // same as usual.
    ConnectionSpec spec = DefaultConnectionSpec.newSpec();
    spec.setDatabase(11).setCredentials("jredis".getBytes());
   
    // only need to use the specific class.
    jredis = new JRedisPipelineService(spec);
  }
View Full Code Here

   */
  @Override
  protected JRedisFuture newProviderInstance () {
    JRedisFuture provider = null;
    try {
      ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(this.host, this.port, this.db2, this.password.getBytes());
      provider = new JRedisChunkedPipeline(connectionSpec);
        }
        catch (ClientRuntimeException e) {
          Log.error(e.getLocalizedMessage());
        }
View Full Code Here

    new JRedisServiceBenchmark(poolCnt, host, port, db, password).runBenchmarks (host, port, workerCnt, reqCnt, size, db);
  }
 
  final JRedis jredisService;
    public JRedisServiceBenchmark (int poolCnt, String host, int port, int db, String password) {
    ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec("localhost", 6379, db, "jredis".getBytes());
    jredisService = new JRedisService(connectionSpec, poolCnt);
    super.quitOnRunEnd(false);
    }
View Full Code Here

   
    new JRedisPipelineServiceBenchmark(host, port, db, password).runBenchmarks (host, port, workerCnt, reqCnt, size, db);
  }
  final JRedis jredisService;
    public JRedisPipelineServiceBenchmark (String host, int port, int db, String password) {
    ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec("localhost", 6379, db, "jredis".getBytes());
    jredisService = new JRedisPipelineService(connectionSpec);
    super.quitOnRunEnd(false);
    }
View Full Code Here

    new HelloAgain().run(password);
  }

  private void run(String password) {
    try {
      ConnectionSpec spec = DefaultConnectionSpec.newSpec().setCredentials(password);
      JRedis  jredis = new JRedisClient(spec);
      jredis.ping();
     
      if(!jredis.exists(bkey)) {
        jredis.set(bkey, "Hello Again!");
View Full Code Here

TOP

Related Classes of org.jredis.connector.ConnectionSpec

Copyright © 2018 www.massapicom. 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.