?? getoperationimpl.java
字號(hào):
package net.spy.memcached.protocol.binary;import java.util.Collection;import java.util.Collections;import net.spy.memcached.ops.GetOperation;import net.spy.memcached.ops.GetsOperation;import net.spy.memcached.ops.OperationStatus;class GetOperationImpl extends OperationImpl implements GetOperation, GetsOperation { static final int CMD=0; /** * Length of the extra header stuff for a GET response. */ static final int EXTRA_HDR_LEN=4; private final String key; public GetOperationImpl(String k, GetOperation.Callback cb) { super(CMD, generateOpaque(), cb); key=k; } public GetOperationImpl(String k, GetsOperation.Callback cb) { super(CMD, generateOpaque(), cb); key=k; } @Override public void initialize() { prepareBuffer(key, 0, EMPTY_BYTES); } @Override protected void decodePayload(byte[] pl) { final int flags=decodeInt(pl, 0); final byte[] data=new byte[pl.length - EXTRA_HDR_LEN]; System.arraycopy(pl, EXTRA_HDR_LEN, data, 0, pl.length-EXTRA_HDR_LEN); // Assume we're processing a get unless the cast fails. try { GetOperation.Callback cb=(GetOperation.Callback)getCallback(); cb.gotData(key, flags, data); } catch(ClassCastException e) { GetsOperation.Callback cb=(GetsOperation.Callback)getCallback(); cb.gotData(key, flags, responseCas, data); } getCallback().receivedStatus(STATUS_OK); } @Override protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) { return errCode == ERR_NOT_FOUND ? NOT_FOUND_STATUS : null; } public Collection<String> getKeys() { return Collections.singleton(key); }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -