Package net.spy.memcached

Examples of net.spy.memcached.MemcachedClient


    }

  public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
  {
    long clientHandle = ((IntegerValue) args[0].itemAt(0)).getLong();
    MemcachedClient client = MemcachedModule.retrieveClient(clientHandle);

    client.flush();
   
    return Sequence.EMPTY_SEQUENCE;
  }
View Full Code Here


    }

  public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
  {
    long clientHandle = ((IntegerValue) args[0].itemAt(0)).getLong();
    MemcachedClient client = MemcachedModule.retrieveClient(clientHandle);

    String key = args[1].itemAt(0).getStringValue();
   
    Object o = client.get(key);
   
        if (o == null) {
            return Sequence.EMPTY_SEQUENCE;
        }
       
View Full Code Here

    }

  public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
  {
    long clientHandle = ((IntegerValue) args[0].itemAt(0)).getLong();
    MemcachedClient client = MemcachedModule.retrieveClient(clientHandle);

    String key = args[1].itemAt(0).getStringValue();
   
    client.delete(key);
   
    return Sequence.EMPTY_SEQUENCE;
  }
View Full Code Here

    return( clientHandle );
  }

  final static synchronized  void shutdownClient( long clientHandle )
  {
    MemcachedClient client = clients.get( clientHandle );
    client.shutdown();
    clients.remove( Long.valueOf( clientHandle ) ) ;
  }
View Full Code Here

      System.out.println("List of IP addresses : " + ipAddress);
    }

    long total_items = 0;
    // Flush the memcache servers before setting the values
    MemcachedClient myMCC;
    myMCC = new MemcachedClient(AddrUtil.getAddresses(ipAddress));

    Map<SocketAddress, Map<String, String>> stats = myMCC.getStats();
   
    for ( Map.Entry<SocketAddress, Map<String, String>> e : stats.entrySet()) {
      System.out.println("memcached server: " + e.getKey().toString());
     
      for (Map.Entry<String, String> s : e.getValue().entrySet()) {
View Full Code Here

    }

    // Path for output of reducer.
    String extraPath = "/tmp";
    // Flush the memcache servers before setting the values
    MemcachedClient myMCC;
    myMCC = new MemcachedClient(AddrUtil.getAddresses(ipAddress));
    myMCC.flush();
    myMCC.shutdown();

    // Number of maptask has to be one else some values get converted to
    // null in memcache.
    // TODO : Check why this happens
    int mapTasks = Integer.parseInt(args[2]); // Integer.parseInt(args[2]);
View Full Code Here

    // Method to set up memcache connection from client to all servers. The
    // list of servers is obtained
    // from the JobConf variable set up in the main.
    public void configure(JobConf conf) {
      try {
        memcachedClient = new MemcachedClient(AddrUtil.getAddresses(conf.get("ADDRESSES")));
        Thread.sleep(500);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

    // Method to set up memcache connection from client to all servers. The
    // list of servers is obtained
    // from the JobConf variable set up in the main.
    public void configure(JobConf conf) {
      try {
        memcachedClient = new MemcachedClient(AddrUtil.getAddresses(conf.get("ADDRESSES")));
        Thread.sleep(500);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

    String pathOfIpAddressFile = args[0];
    String inputPathSeqFile = args[1];

    String ipAddress = getListOfIpAddresses(pathOfIpAddressFile);
    MemcachedClient myMCC = new MemcachedClient(AddrUtil.getAddresses(ipAddress));

    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(conf);
    SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(inputPathSeqFile),
        new Configuration());

    Text text = new Text();
    FloatWritable f = new FloatWritable();

    long startTime = System.currentTimeMillis();
    int cnt = 0;
    while (reader.next(text, f)) {
      if ( cnt % 1000 == 0 )
        System.out.print(".");
     
      // System.out.println(text + " " + f);
      Object obj = myMCC.get(text.toString());
      if (obj == null)
        throw new RuntimeException("Error getting from memcache: key=" + text);
      cnt++;
    }
    reader.close();
View Full Code Here

      } else {
        opQueueFactory = new LinkedOperationQueueFactory();
      }

      return new MemcachedCache(
        new MemcachedClient(
          new ConnectionFactoryBuilder().setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
                                        .setHashAlg(DefaultHashAlgorithm.FNV1A_64_HASH)
                                        .setLocatorType(ConnectionFactoryBuilder.Locator.CONSISTENT)
                                        .setDaemon(true)
                                        .setFailureMode(FailureMode.Cancel)
View Full Code Here

TOP

Related Classes of net.spy.memcached.MemcachedClient

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.