本文整理汇总了Java中com.thimbleware.jmemcached.protocol.ResponseMessage类的典型用法代码示例。如果您正苦于以下问题:Java ResponseMessage类的具体用法?Java ResponseMessage怎么用?Java ResponseMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseMessage类属于com.thimbleware.jmemcached.protocol包,在下文中一共展示了ResponseMessage类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStatusCode
import com.thimbleware.jmemcached.protocol.ResponseMessage; //导入依赖的package包/类
public ResponseCode getStatusCode(ResponseMessage command) {
Op cmd = command.cmd.op;
if (cmd == Op.GET || cmd == Op.GETS) {
return ResponseCode.OK;
} else if (cmd == Op.SET || cmd == Op.CAS || cmd == Op.ADD || cmd == Op.REPLACE || cmd == Op.APPEND || cmd == Op.PREPEND) {
switch (command.response) {
case EXISTS:
return ResponseCode.KEYEXISTS;
case NOT_FOUND:
return ResponseCode.KEYNF;
case NOT_STORED:
return ResponseCode.NOT_STORED;
case STORED:
return ResponseCode.OK;
}
} else if (cmd == Op.INCR || cmd == Op.DECR) {
return command.incrDecrResponse == null ? ResponseCode.KEYNF : ResponseCode.OK;
} else if (cmd == Op.DELETE) {
switch (command.deleteResponse) {
case DELETED:
return ResponseCode.OK;
case NOT_FOUND:
return ResponseCode.KEYNF;
}
} else if (cmd == Op.STATS) {
return ResponseCode.OK;
} else if (cmd == Op.VERSION) {
return ResponseCode.OK;
} else if (cmd == Op.FLUSH_ALL) {
return ResponseCode.OK;
}
return ResponseCode.UNKNOWN;
}
示例2: getStatusCode
import com.thimbleware.jmemcached.protocol.ResponseMessage; //导入依赖的package包/类
public ResponseCode getStatusCode(ResponseMessage command) {
Command cmd = command.cmd.cmd;
if (cmd == Command.GET || cmd == Command.GETS) {
return ResponseCode.OK;
} else if (cmd == Command.SET || cmd == Command.CAS || cmd == Command.ADD || cmd == Command.REPLACE || cmd == Command.APPEND || cmd == Command.PREPEND) {
switch (command.response) {
case EXISTS:
return ResponseCode.KEYEXISTS;
case NOT_FOUND:
return ResponseCode.KEYNF;
case NOT_STORED:
return ResponseCode.NOT_STORED;
case STORED:
return ResponseCode.OK;
}
} else if (cmd == Command.INCR || cmd == Command.DECR) {
return command.incrDecrResponse == null ? ResponseCode.KEYNF : ResponseCode.OK;
} else if (cmd == Command.DELETE) {
switch (command.deleteResponse) {
case DELETED:
return ResponseCode.OK;
case NOT_FOUND:
return ResponseCode.KEYNF;
}
} else if (cmd == Command.STATS) {
return ResponseCode.OK;
} else if (cmd == Command.VERSION) {
return ResponseCode.OK;
} else if (cmd == Command.FLUSH_ALL) {
return ResponseCode.OK;
}
return ResponseCode.UNKNOWN;
}