diff --git a/src/main/java/net/spy/memcached/plugin/FrontCacheMemcachedClient.java b/src/main/java/net/spy/memcached/plugin/FrontCacheMemcachedClient.java index 2f5f4eaa6..58c1add27 100644 --- a/src/main/java/net/spy/memcached/plugin/FrontCacheMemcachedClient.java +++ b/src/main/java/net/spy/memcached/plugin/FrontCacheMemcachedClient.java @@ -20,25 +20,19 @@ import java.net.InetSocketAddress; import java.util.Collection; import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.Map; import java.util.Iterator; -import java.util.Arrays; import java.util.HashMap; import net.spy.memcached.ConnectionFactory; import net.spy.memcached.MemcachedClient; -import net.spy.memcached.OperationTimeoutException; import net.spy.memcached.internal.GetFuture; import net.spy.memcached.internal.OperationFuture; import net.spy.memcached.ops.OperationStatus; import net.spy.memcached.ops.StatusCode; import net.spy.memcached.internal.BulkFuture; import net.spy.memcached.internal.BulkGetFuture; -import net.spy.memcached.internal.SingleElementInfiniteIterator; import net.spy.memcached.transcoders.Transcoder; /** @@ -82,62 +76,6 @@ public FrontCacheMemcachedClient(ConnectionFactory cf, } } - /** - * Get with a single key and decode using the default transcoder. - * - * @param key the key to get - * @return the result from the cache (null if there is none) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public Object get(String key) { - return get(key, transcoder); - } - - /** - * Get with a single key. - * - * @param Type of object to get. - * @param key the key to get - * @param tc the transcoder to serialize and unserialize value - * @return the result from the cache (null if there is none) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - - public T get(String key, Transcoder tc) { - Future future = asyncGet(key, tc); - try { - return future.get(operationTimeout, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - future.cancel(true); - throw new RuntimeException("Interrupted waiting for value", e); - } catch (ExecutionException e) { - future.cancel(true); - throw new RuntimeException("Exception waiting for value", e); - } catch (TimeoutException e) { - future.cancel(true); - throw new OperationTimeoutException(e); - } - } - - /** - * Get the given key asynchronously and decode with the default - * transcoder. - * - * @param key the key to fetch - * @return a future that will hold the return value of the fetch - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public GetFuture asyncGet(final String key) { - return asyncGet(key, transcoder); - } - /** * Get the value of the key. * Check the local cache first. If the key is not found, send the command to the server. @@ -185,133 +123,6 @@ public OperationStatus getStatus() { return new FrontCacheGetFuture(localCacheManager, key, parent); } - /** - * Get the values for multiple keys from the cache. - * - * @param keys the keys - * @return a map of the values (for each value that exists) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public Map getBulk(Collection keys) { - return getBulk(keys, transcoder); - } - - /** - * Get the values for multiple keys from the cache. - * - * @param - * @param tc the transcoder to serialize and unserialize value - * @param keys the keys - * @return a map of the values (for each value that exists) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public Map getBulk(Transcoder tc, String... keys) { - return getBulk(Arrays.asList(keys), tc); - } - - /** - * Get the values for multiple keys from the cache. - * - * @param keys the keys - * @return a map of the values (for each value that exists) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public Map getBulk(String... keys) { - return getBulk(Arrays.asList(keys), transcoder); - } - - /** - * Get the values for multiple keys from the cache. - * - * @param - * @param keys the keys - * @param tc the transcoder to serialize and unserialize value - * @return a map of the values (for each value that exists) - * @throws OperationTimeoutException if the global operation timeout is - * exceeded - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public Map getBulk(Collection keys, - Transcoder tc) { - BulkFuture> future = asyncGetBulk(keys, tc); - try { - return future.get(operationTimeout, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - future.cancel(true); - throw new RuntimeException("Interrupted getting bulk values", e); - } catch (ExecutionException e) { - future.cancel(true); - throw new RuntimeException("Failed getting bulk values", e); - } catch (TimeoutException e) { - future.cancel(true); - throw new OperationTimeoutException(e); - } - } - - /** - * Asynchronously get a bunch of objects from the cache. - * - * @param - * @param keys the keys to request - * @param tc the transcoder to serialize and unserialize values - * @return a Future result of that fetch - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public BulkFuture> asyncGetBulk(Collection keys, Transcoder tc) { - return asyncGetBulk(keys, new SingleElementInfiniteIterator>(tc)); - } - - /** - * Asynchronously get a bunch of objects from the cache and decode them - * with the given transcoder. - * - * @param keys the keys to request - * @return a Future result of that fetch - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public BulkFuture> asyncGetBulk(Collection keys) { - return asyncGetBulk(keys, transcoder); - } - - /** - * Varargs wrapper for asynchronous bulk get. - * - * @param - * @param tc the transcoder to serialize and unserialize value - * @param keys one more keys to get - * @return the future values of those keys - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public BulkFuture> asyncGetBulk(Transcoder tc, - String... keys) { - return asyncGetBulk(Arrays.asList(keys), tc); - } - - /** - * Varargs wrapper for asynchronous bulk get with the default transcoder. - * - * @param keys one more keys to get - * @return the future values of those keys - * @throws IllegalStateException in the rare circumstance where queue - * is too full to accept any more requests - */ - public BulkFuture> asyncGetBulk(String... keys) { - return asyncGetBulk(Arrays.asList(keys), transcoder); - } - /** * Asynchronously gets (with CAS support) a bunch of objects from the cache. * If used with front cache, the front cache is checked first.