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

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

There is a newer version: 2.8.4
Show 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 = 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, 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> asyncGetAndLock(final String key, int exp);

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

	CASValue getAndLock(String key, int exp);

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

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

	 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;

	 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, 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 asyncDecr(String key, int by);

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