本文整理匯總了Java中net.spy.memcached.ops.MutatorOperation類的典型用法代碼示例。如果您正苦於以下問題:Java MutatorOperation類的具體用法?Java MutatorOperation怎麽用?Java MutatorOperation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MutatorOperation類屬於net.spy.memcached.ops包,在下文中一共展示了MutatorOperation類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOperationName
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public static <T extends Operation> String getOperationName(T operation) {
//TODO optimize. Convert multiple if/else to switch or map.get()
String op;
if (operation instanceof StoreOperation) {
op = ((StoreOperation) operation).getStoreType().name();
} else if (operation instanceof ConcatenationOperation) {
op = ((ConcatenationOperation) operation).getStoreType().name();
} else if (operation instanceof GetsOperation) {
op = "get";
} else if (operation instanceof GetOperation) {
op = "get";
} else if (operation instanceof GetAndTouchOperation) {
op = "gat";
} else if (operation instanceof MutatorOperation) {
op = ((MutatorOperation) operation).getType().name();
} else {
op = Operations.getOperationName(operation.getClass());
}
return op;
}
示例2: testMutatorOperationIncrCloning
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
@Override
public void testMutatorOperationIncrCloning() {
int exp = 823862;
long def = 28775;
int by = 7735;
MutatorOperation op = ofact.mutate(Mutator.incr, TEST_KEY, by, def,
exp, genericCallback);
MutatorOperation op2 = cloneOne(MutatorOperation.class, op);
assertKey(op2);
assertEquals(-1, op2.getExpiration());
assertEquals(-1, op2.getDefault());
assertEquals(by, op2.getBy());
assertSame(Mutator.incr, op2.getType());
assertCallback(op2);
}
示例3: testMutatorOperationDecrCloning
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
@Override
public void testMutatorOperationDecrCloning() {
int exp = 823862;
long def = 28775;
int by = 7735;
MutatorOperation op = ofact.mutate(Mutator.decr, TEST_KEY, by, def,
exp, genericCallback);
MutatorOperation op2 = cloneOne(MutatorOperation.class, op);
assertKey(op2);
assertEquals(-1, op2.getExpiration());
assertEquals(-1, op2.getDefault());
assertEquals(by, op2.getBy());
assertSame(Mutator.decr, op2.getType());
assertCallback(op2);
}
示例4: testMutatorOperationIncrCloning
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public void testMutatorOperationIncrCloning() {
int exp = 823862;
long def = 28775;
int by = 7735;
MutatorOperation op = ofact.mutate(Mutator.incr, TEST_KEY, by, def,
exp, genericCallback);
MutatorOperation op2 = cloneOne(MutatorOperation.class, op);
assertKey(op2);
assertEquals(exp, op2.getExpiration());
assertEquals(def, op2.getDefault());
assertEquals(by, op2.getBy());
assertSame(Mutator.incr, op2.getType());
assertCallback(op2);
}
示例5: testMutatorOperationDecrCloning
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public void testMutatorOperationDecrCloning() {
int exp = 823862;
long def = 28775;
int by = 7735;
MutatorOperation op = ofact.mutate(Mutator.decr, TEST_KEY, by, def,
exp, genericCallback);
MutatorOperation op2 = cloneOne(MutatorOperation.class, op);
assertKey(op2);
assertEquals(exp, op2.getExpiration());
assertEquals(def, op2.getDefault());
assertEquals(by, op2.getBy());
assertSame(Mutator.decr, op2.getType());
assertCallback(op2);
}
示例6: mutate
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public MutatorOperation mutate(Mutator m, String key, long by, long def,
int exp, OperationCallback cb) {
return new MutatorOperationImpl(m, key, by, def, exp, cb);
}
示例7: mutate
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public MutatorOperation mutate(Mutator m, String key, long by, long exp,
int def, OperationCallback cb) {
return new MutatorOperationImpl(m, key, by, cb);
}
示例8: mutate
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
public MutatorOperation mutate(Mutator m, String key, int by,
long def, int exp, OperationCallback cb) {
return new MutatorOperationImpl(m, key, by, def, exp, cb);
}
示例9: mutate
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
/**
* Create a mutator operation.
*
* @param m the mutator type
* @param key the mutatee key
* @param by the amount to increment or decrement
* @param def the default value
* @param exp expiration in case we need to default (0 if no default)
* @param cb the status callback
* @return the new mutator operation
*/
MutatorOperation mutate(Mutator m, String key, long by, long def, int exp,
OperationCallback cb);
示例10: mutate
import net.spy.memcached.ops.MutatorOperation; //導入依賴的package包/類
/**
* Create a mutator operation.
*
* @param m the mutator type
* @param key the mutatee key
* @param by the amount to increment or decrement
* @param def the default value
* @param exp expiration in case we need to default (0 if no default)
* @param cb the status callback
* @return the new mutator operation
*/
MutatorOperation mutate(Mutator m, String key, int by,
long def, int exp, OperationCallback cb);