All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.spy.memcached.MemcachedClientIF Maven / Gradle / Ivy

The newest version!
package net.spy.memcached;

import java.net.SocketAddress;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.internal.BulkFuture;
import net.spy.memcached.transcoders.Transcoder;

/**
 * This interface is provided as a helper for testing clients of the MemcachedClient.
 */
public interface MemcachedClientIF {
  /**
   * Maximum supported key length.
   */
  int MAX_KEY_LENGTH = 4000;

  Collection getAvailableServers();

  Collection getUnavailableServers();

  Transcoder getTranscoder();

  NodeLocator getNodeLocator();

  Future append(long cas, String key, Object val);

   Future append(long cas, String key, T val,
                             Transcoder tc);

  Future prepend(long cas, String key, Object val);

   Future prepend(long cas, String key, T val,
                              Transcoder tc);

   Future asyncCAS(String key, long casId, T value,
                                   Transcoder tc);

  Future asyncCAS(String key, long casId, Object value);

   Future asyncCAS(String key, long casId, int exp, T value,
                                   Transcoder tc);

  Future asyncCAS(String key, long casId, int exp, Object value);

   CASResponse cas(String key, long casId, int exp, T value, Transcoder tc)
          throws OperationTimeoutException;

  CASResponse cas(String key, long casId, int exp, Object value)
          throws OperationTimeoutException;

   CASResponse cas(String key, long casId, T value, Transcoder tc)
          throws OperationTimeoutException;

  CASResponse cas(String key, long casId, Object value)
          throws OperationTimeoutException;

   Future add(String key, int exp, T o, Transcoder tc);

  Future add(String key, int exp, Object o);

   Future set(String key, int exp, T o, Transcoder tc);

  Future set(String key, int exp, Object o);

   Future replace(String key, int exp, T o,
                              Transcoder tc);

  Future replace(String key, int exp, Object o);

   Future asyncGet(String key, Transcoder tc);

  Future asyncGet(String key);

   Future> asyncGets(String key,
                                    Transcoder tc);

  Future> asyncGets(String key);

   CASValue gets(String key, Transcoder tc)
          throws OperationTimeoutException;

  CASValue gets(String key) throws OperationTimeoutException;

   T get(String key, Transcoder tc)
          throws OperationTimeoutException;

  Object get(String key) throws OperationTimeoutException;

   BulkFuture> asyncGetBulk(Collection keys,
                                              Iterator> tcs);

   BulkFuture> asyncGetBulk(Collection keys,
                                              Transcoder tc);

  BulkFuture> asyncGetBulk(Collection keys);

   BulkFuture> asyncGetBulk(Transcoder tc,
                                              String... keys);

  BulkFuture> asyncGetBulk(String... keys);

   BulkFuture>> asyncGetsBulk(Collection keys,
                                                         Iterator> tcs);

   BulkFuture>> asyncGetsBulk(Collection keys,
                                                         Transcoder tc);

  BulkFuture>> asyncGetsBulk(Collection keys);

   BulkFuture>> asyncGetsBulk(Transcoder tc,
                                                         String... keys);

  BulkFuture>> asyncGetsBulk(String... keys);

   Map getBulk(Collection keys, Transcoder tc)
          throws OperationTimeoutException;

  Map getBulk(Collection keys)
          throws OperationTimeoutException;

   Map getBulk(Transcoder tc, String... keys)
          throws OperationTimeoutException;

  Map getBulk(String... keys)
          throws OperationTimeoutException;

   Map> getsBulk(Collection keys, Transcoder tc)
          throws OperationTimeoutException;

  Map> getsBulk(Collection keys)
          throws OperationTimeoutException;

   Map> getsBulk(Transcoder tc, String... keys)
          throws OperationTimeoutException;

  Map> getsBulk(String... keys)
          throws OperationTimeoutException;

  Map getVersions();

  Map> getStats();

  Map> getStats(String prefix);

  long incr(String key, int by) throws OperationTimeoutException;

  long decr(String key, int by) throws OperationTimeoutException;

  long incr(String key, int by, long def, int exp)
          throws OperationTimeoutException;

  long decr(String key, int by, long def, int exp)
          throws OperationTimeoutException;

  Future asyncIncr(String key, int by);

  Future asyncIncr(String key, int by, long def, int exp);

  Future asyncDecr(String key, int by);

  Future asyncDecr(String key, int by, long def, int exp);

  long incr(String key, int by, long def)
          throws OperationTimeoutException;

  long decr(String key, int by, long def)
          throws OperationTimeoutException;

  Future delete(String key);

  Future flush(int delay);

  Future flush();

  void shutdown();

  boolean shutdown(long timeout, TimeUnit unit);

  boolean waitForQueues(long timeout, TimeUnit unit);

  boolean addObserver(ConnectionObserver obs);

  boolean removeObserver(ConnectionObserver obs);

  /**
   * Get the set of SASL mechanisms supported by the servers.
   *
   * @return the union of all SASL mechanisms supported by the servers.
   */
  Set listSaslMechanisms();
}