本文整理汇总了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);