net.spy.memcached.protocol.binary
Class BinaryOperationFactory

java.lang.Object
  extended by net.spy.memcached.ops.BaseOperationFactory
      extended by net.spy.memcached.protocol.binary.BinaryOperationFactory
All Implemented Interfaces:
OperationFactory

public class BinaryOperationFactory
extends BaseOperationFactory

Factory for binary operations.


Constructor Summary
BinaryOperationFactory()
           
 
Method Summary
 CASOperation cas(StoreType type, String key, long casId, int flags, int exp, byte[] data, OperationCallback cb)
          Create a CAS operation.
 ConcatenationOperation cat(ConcatenationType catType, long casId, String key, byte[] data, OperationCallback cb)
          Get a concatenation operation.
protected  Collection<? extends Operation> cloneGet(KeyedOperation op)
           
 DeleteOperation delete(String key, OperationCallback operationCallback)
          Create a deletion operation.
 FlushOperation flush(int delay, OperationCallback cb)
          Create a flush operation.
 GetOperation get(Collection<String> value, GetOperation.Callback cb)
          Create a get operation.
 GetOperation get(String key, GetOperation.Callback callback)
          Create a get operation.
 GetsOperation gets(String key, GetsOperation.Callback cb)
          Create a gets operation.
 MutatorOperation mutate(Mutator m, String key, int by, long def, int exp, OperationCallback cb)
          Create a mutator operation.
 NoopOperation noop(OperationCallback cb)
          Create a NOOP operation.
 StatsOperation stats(String arg, StatsOperation.Callback cb)
          Get a new StatsOperation.
 StoreOperation store(StoreType storeType, String key, int flags, int exp, byte[] data, OperationCallback cb)
          Create a store operation.
 VersionOperation version(OperationCallback cb)
          Create a new version operation.
 
Methods inherited from class net.spy.memcached.ops.BaseOperationFactory
clone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryOperationFactory

public BinaryOperationFactory()
Method Detail

delete

public DeleteOperation delete(String key,
                              OperationCallback operationCallback)
Description copied from interface: OperationFactory
Create a deletion operation.

Parameters:
key - the key to delete
operationCallback - the status callback
Returns:
the new DeleteOperation

flush

public FlushOperation flush(int delay,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Create a flush operation.

Parameters:
delay - delay until flush.
cb - the status callback
Returns:
the new FlushOperation

get

public GetOperation get(String key,
                        GetOperation.Callback callback)
Description copied from interface: OperationFactory
Create a get operation.

Parameters:
key - the key to get
callback - the callback that will contain the results
Returns:
a new GetOperation

get

public GetOperation get(Collection<String> value,
                        GetOperation.Callback cb)
Description copied from interface: OperationFactory
Create a get operation.

Parameters:
value - the collection of keys to get
cb - the callback that will contain the results
Returns:
a new GetOperation

gets

public GetsOperation gets(String key,
                          GetsOperation.Callback cb)
Description copied from interface: OperationFactory
Create a gets operation.

Parameters:
key - the key to get
cb - the callback that will contain the results
Returns:
a new GetsOperation

mutate

public MutatorOperation mutate(Mutator m,
                               String key,
                               int by,
                               long def,
                               int exp,
                               OperationCallback cb)
Description copied from interface: OperationFactory
Create a mutator operation.

Parameters:
m - the mutator type
key - the mutatee key
by - the amount to increment or decrement
def - the default value
exp - expiration in case we need to default (0 if no default)
cb - the status callback
Returns:
the new mutator operation

stats

public StatsOperation stats(String arg,
                            StatsOperation.Callback cb)
Description copied from interface: OperationFactory
Get a new StatsOperation.

Parameters:
arg - the stat parameter (see protocol docs)
cb - the stats callback
Returns:
the new StatsOperation

store

public StoreOperation store(StoreType storeType,
                            String key,
                            int flags,
                            int exp,
                            byte[] data,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Create a store operation.

Parameters:
storeType - the type of store operation
key - the key to store
flags - the storage flags
exp - the expiration time
data - the data
cb - the status callback
Returns:
the new store operation

version

public VersionOperation version(OperationCallback cb)
Description copied from interface: OperationFactory
Create a new version operation.


noop

public NoopOperation noop(OperationCallback cb)
Description copied from interface: OperationFactory
Create a NOOP operation.

Parameters:
cb - the operation callback
Returns:
the new NoopOperation

cas

public CASOperation cas(StoreType type,
                        String key,
                        long casId,
                        int flags,
                        int exp,
                        byte[] data,
                        OperationCallback cb)
Description copied from interface: OperationFactory
Create a CAS operation.

key - the key to store
casId - the CAS identifier value (from a gets operation)
flags - the storage flags
exp - the expiration time
data - the data
cb - the status callback
Returns:
the new store operation

cat

public ConcatenationOperation cat(ConcatenationType catType,
                                  long casId,
                                  String key,
                                  byte[] data,
                                  OperationCallback cb)
Description copied from interface: OperationFactory
Get a concatenation operation.

Parameters:
catType - the type of concatenation to perform.
casId - the CAS value for an atomic compare-and-cat
key - the key
data - the data to store
cb - a callback for reporting the status
Returns:
thew new ConcatenationOperation

cloneGet

protected Collection<? extends Operation> cloneGet(KeyedOperation op)
Specified by:
cloneGet in class BaseOperationFactory