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

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

Go to download

Amazon ElastiCache Cluster Client is an enhanced Java library to connect to ElastiCache clusters. This client library has been built upon Spymemcached and is released under the Amazon Software License.

There is a newer version: 1.2.2
Show newest version
/**
 * Copyright (C) 2006-2009 Dustin Sallings
 * Copyright (C) 2009-2011 Couchbase, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALING
 * IN THE SOFTWARE.
 */

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 = 250;

  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);

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

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

   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> asyncGetAndTouch(final String key, final int exp);

   Future> asyncGetAndTouch(final String key, final int exp,
      final Transcoder tc);

  CASValue getAndTouch(String key, int exp);

   CASValue getAndTouch(String key, int exp, Transcoder tc);

   Future> asyncGets(String key, Transcoder tc);

  Future> asyncGets(String key);

   CASValue gets(String key, Transcoder tc);

  CASValue gets(String key);

   T get(String key, Transcoder tc);

  Object get(String key);

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

   BulkFuture> asyncGetBulk(Iterator keys,
      Transcoder tc);
   BulkFuture> asyncGetBulk(Collection keys,
      Transcoder tc);

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

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

  BulkFuture> asyncGetBulk(String... keys);

   Map getBulk(Iterator keys, Transcoder tc);
   Map getBulk(Collection keys, Transcoder tc);

  Map getBulk(Iterator keys);
  Map getBulk(Collection keys);

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

  Map getBulk(String... keys);

   Future touch(final String key, final int exp,
      final Transcoder tc);

   Future touch(final String key, final int exp);

  Map getVersions();

  Map> getStats();

  Map> getStats(String prefix);

  long incr(String key, long by);

  long incr(String key, int by);

  long decr(String key, long by);

  long decr(String key, int by);

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

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

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

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

  Future asyncIncr(String key, long by);

  Future asyncIncr(String key, int by);

  Future asyncDecr(String key, long by);

  Future asyncDecr(String key, int by);

  long incr(String key, long by, long def);

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

  long decr(String key, long by, long def);

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

  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();
}