com.yahoo.ycsb.memcached
Class Memcached

java.lang.Object
  extended by com.yahoo.ycsb.DataStore
      extended by com.yahoo.ycsb.memcached.Memcached
Direct Known Subclasses:
MemcachedWrapper, SpymemcachedClient

public abstract class Memcached
extends DataStore

A layer for accessing a database to be benchmarked. Each thread in the client will be given its own instance of whatever DB class is to be used in the test. This class should be constructed using a no-argument constructor, so we can load it dynamically. Any argument-based initialization should be done by init(). Note that YCSB does not make any use of the return codes returned by this class. Instead, it keeps a count of the return values and presents them to the user. The semantics of methods such as insert, update and delete vary from database to database. In particular, operations may or may not be durable once these methods commit, and some systems may return 'success' regardless of whether or not a tuple with a matching key existed before the call. Rather than dictate the exact semantics of these methods, we recommend you either implement them to match the database's default semantics, or the semantics of your target application. For the sake of comparison between experiments we also recommend you explain the semantics you chose when presenting performance results.


Constructor Summary
Memcached()
           
 
Method Summary
abstract  int add(java.lang.String key, java.lang.Object value)
          Add a value in the database.
abstract  int append(java.lang.String key, long cas, java.lang.Object value)
          Append a value in the database.
abstract  int cas(java.lang.String key, long cas, java.lang.Object value)
          Does a Create and store operation.
abstract  int decr(java.lang.String key, java.lang.Object value)
          Decrement a value in the database.
abstract  int delete(java.lang.String key)
          Delete a value from the database.
abstract  int get(java.lang.String key, java.lang.Object value)
          Get a value from the database.
abstract  long gets(java.lang.String key)
          Get a CAS identifier for a value in the database
abstract  int incr(java.lang.String key, java.lang.Object value)
          Increment a value in the database.
abstract  int prepend(java.lang.String key, long cas, java.lang.Object value)
          Prepends a value to a specific keys current value
abstract  int replace(java.lang.String key, java.lang.Object value)
          Replaces the current value of a key if the key already exists
abstract  int set(java.lang.String key, java.lang.Object value)
          Set a record in the database.
 
Methods inherited from class com.yahoo.ycsb.DataStore
cleanup, getProperties, init, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Memcached

public Memcached()
Method Detail

add

public abstract int add(java.lang.String key,
                        java.lang.Object value)
Add a value in the database. Any key/value pair in the specified value Object will be added as a value to a specific key.

Parameters:
key - The key of the value to add.
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

append

public abstract int append(java.lang.String key,
                           long cas,
                           java.lang.Object value)
Append a value in the database. Any key/value pair in the specified value Object will be appended onto the value with the specified key.

Parameters:
key - The key of the value to be appended to.
cas - The cas value needed to do the append
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

cas

public abstract int cas(java.lang.String key,
                        long cas,
                        java.lang.Object value)
Does a Create and store operation.

Parameters:
key - The key of the value to do the cas.
cas - The cas value needed to do the append
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

decr

public abstract int decr(java.lang.String key,
                         java.lang.Object value)
Decrement a value in the database.

Parameters:
key - The key of the value to be decremented.
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

delete

public abstract int delete(java.lang.String key)
Delete a value from the database.

Parameters:
key - The key of the value to be deleted.
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

incr

public abstract int incr(java.lang.String key,
                         java.lang.Object value)
Increment a value in the database.

Parameters:
key - The key of the value to be incremented.
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

get

public abstract int get(java.lang.String key,
                        java.lang.Object value)
Get a value from the database. Any key/value pair in the specified value Object will be check against the value returned from the database.

Parameters:
key - The key of the value to get.
value - The Object that the key should contain
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

gets

public abstract long gets(java.lang.String key)
Get a CAS identifier for a value in the database

Parameters:
key - The key of the value to get a CAS identifier for
Returns:
The CAS identifier on success, a non-zero error code on error. See this class's description for a discussion of error codes.

prepend

public abstract int prepend(java.lang.String key,
                            long cas,
                            java.lang.Object value)
Prepends a value to a specific keys current value

Parameters:
key - The key of the value to prepend.
value - The Object to prepend to the current key
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

replace

public abstract int replace(java.lang.String key,
                            java.lang.Object value)
Replaces the current value of a key if the key already exists

Parameters:
key - The key of the value to replace.
cas - The cas value needed to do the append
value - The Object to replace the old value with
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.

set

public abstract int set(java.lang.String key,
                        java.lang.Object value)
Set a record in the database. Any key/value pair in the specified values Object will be written into the key with the specified value.

Parameters:
key - The key of the value to insert.
value - An Object to use as the key's value
Returns:
Zero on success, a non-zero error code on error. See this class's description for a discussion of error codes.