Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.twitter.finagle.memcached.java;
  
  import java.util.List;
  import java.util.Map;
  
  
A Java-friendly memcached client.
 
 public abstract class Client {
  
Construct a Client from a single Service<Command, Response>

Parameters:
finagleClient a Service<Command, Response>
Returns:
a Client.
 
   public static Client newInstance(Service<CommandResponsefinagleClient) {
     com.twitter.finagle.memcached.Client schmemcachedClient =
       ......apply(finagleClient);
     return new com.twitter.finagle.memcached.java.ClientBase(schmemcachedClient);
   }

  
Get a key from the server.
 
   abstract public Future<ChannelBufferget(String key);

  
Get a key from the server together with a "cas unique" token used in cas operations.
 
   abstract public Future<ResultWithCASgets(String key);

  
Get a set of keys from the server.

Returns:
a Map[String, ChannelBuffer] of all of the keys that the server had.
 
   abstract public Future<Map<StringChannelBuffer>> get(List<Stringkeys);

  
Get a set of keys from the server together with a "cas unique" token.

Returns:
a Map[String, ResultWithCAS] of all of the keys that the server had.
 
   abstract public Future<Map<StringResultWithCAS>> gets(List<Stringkeys);

  
Store a key. Override an existing value.

Returns:
true
 
   abstract public Future<Voidset(String keyChannelBuffer value);

  
Store a key. Override an existing value.

Returns:
void
 
   abstract public Future<Voidset(String keyint flagsTime expiryChannelBuffer value);

  
Store a key but only if it doesn't already exist on the server.

Returns:
true if stored, false if not stored
 
   abstract public Future<Booleanadd(String keyChannelBuffer value);

  
Store a key but only if it doesn't already exist on the server.

Returns:
true if stored, false if not stored
 
   abstract public Future<Booleanadd(String keyint flagsTime expiryChannelBuffer value);

  
Append bytes to the end of an existing key. If the key doesn't exist, the operation has no effect.

Returns:
true if stored, false if not stored
 
   abstract public Future<Booleanappend(String keyChannelBuffer value);

  
Prepend bytes to the beginning of an existing key. If the key doesn't exist, the operation has no effect.

Returns:
true if stored, false if not stored
 
   abstract public Future<Booleanprepend(String keyChannelBuffer value);

  
Replace bytes on an existing key. If the key doesn't exist, the operation has no effect.

Returns:
true if stored, false if not stored
 
   abstract public Future<Booleanreplace(String keyChannelBuffer value);

  
Replace bytes on an existing key. If the key doesn't exist, the operation has no effect.

Returns:
true if stored, false if not stored
  abstract public Future<Booleanreplace(String keyint flagsTime expiryChannelBuffer value);

 
Perform a compare-and-set operation. This is like a replace, except a token identifying the value version to replace is provided. Tokens are retrieved with "gets"

Returns:
true if stored, false if not stored
  abstract public Future<Booleancas(
    String keyint flagsTime expiry,
    ChannelBuffer valueChannelBuffer casUnique);

  
A version of cas with default flags & expiry paramters.
  abstract public Future<Booleancas(String keyChannelBuffer valueChannelBuffer casUnique);

  
Convenience version of cas used to store string values.
  public Future<Booleancas(String keyString valueChannelBuffer casUnique) {
    return this.cas(keytoChannelBuffer(value), casUnique);
  }

  
Remove a key.

Returns:
true if deleted, false if not found
  abstract public Future<Booleandelete(String key);

  
Increment a key. Interpret the value as an Long if it is parsable. This operation has no effect if there is no value there already.
  abstract public Future<Longincr(String key);
  abstract public Future<Longincr(String keylong delta);

  
Decrement a key. Interpret the value as an Long if it is parsable. This operation has no effect if there is no value there already.
  abstract public Future<Longdecr(String key);
  abstract public Future<Longdecr(String keylong delta);
  public Future<Voidset(String keyString value) {
    return this.set(keytoChannelBuffer(value));
  }
  public Future<Booleanadd(String keyString value) {
    return this.add(keytoChannelBuffer(value));
  }
  public Future<Booleanappend(String keyString value) {
    return this.append(keytoChannelBuffer(value));
  }
  public Future<Booleanprepend(String keyString value) {
    return this.prepend(keytoChannelBuffer(value));
  }

  
release the underlying service(s)
  abstract public void release();
  private ChannelBuffer toChannelBuffer(String value) {
    return ChannelBuffers.wrappedBuffer(value.getBytes());
  }
New to GrepCode? Check out our FAQ X