class MemCacheProtocol(LineReceiver, TimeoutMixin): (source)
Method | __init__ |
Create the protocol. |
Method | add |
Add the given key. It must not exist in the server. |
Method | append |
Append given data to the value of an existing key. |
Method | checkAndSet |
Change the content of key only if the cas value matches the current one associated with the key. Use this to store a value which hasn't been modified since last time you fetched it. |
Method | cmd_CLIENT_ERROR |
An invalid input as been sent. |
Method | cmd_DELETED |
A delete command has completed successfully. |
Method | cmd_END |
This the end token to a get or a stat operation. |
Method | cmd_ERROR |
A non-existent command has been sent. |
Method | cmd_EXISTS |
A checkAndSet update has failed. |
Method | cmd_NOT_FOUND |
Manage error response for incr/decr/delete. |
Method | cmd_NOT_STORED |
Manage a specific 'not stored' response to a set operation: this is not an error, but some condition wasn't met. |
Method | cmd_OK |
The last command has been completed. |
Method | cmd_SERVER_ERROR |
An error has happened server-side. |
Method | cmd_STAT |
Reception of one stat line. |
Method | cmd_STORED |
Manage a success response to a set operation. |
Method | cmd_VALUE |
Prepare the reading a value after a get. |
Method | cmd_VERSION |
Read version token. |
Method | connectionLost |
Cause any outstanding commands to fail. |
Method | decrement |
Decrement the value of key by given value (default to 1). key must be consistent with an int. Return the new value, coerced to 0 if negative. |
Method | delete |
Delete an existing key. |
Method | flushAll |
Flush all cached values. |
Method | get |
No summary |
Method | getMultiple |
No summary |
Method | increment |
Increment the value of key by given value (default to 1). key must be consistent with an int. Return the new value. |
Method | lineReceived |
Receive line commands from the server. |
Method | prepend |
Prepend given data to the value of an existing key. |
Method | rawDataReceived |
Collect data for a get. |
Method | replace |
Replace the given key. It must already exist in the server. |
Method | sendLine |
Override sendLine to add a timeout to response. |
Method | set |
Set the given key. |
Method | stats |
Get some stats from the server. It will be available as a dict. |
Method | timeoutConnection |
Close the connection in case of timeout. |
Method | version |
Get the version of the server. |
Constant | MAX_KEY_LENGTH |
Undocumented |
Instance Variable | persistentTimeOut |
the timeout period used to wait for a response. |
Instance Variable | timeOut |
Undocumented |
Method | _cancelCommands |
Cancel all the outstanding commands, making them fail with reason. |
Method | _get |
Helper method for get and getMultiple. |
Method | _incrdecr |
Internal wrapper for incr/decr. |
Method | _set |
Internal wrapper for setting values. |
Instance Variable | _bufferLength |
the total amount of bytes in _getBuffer. |
Instance Variable | _current |
current list of requests waiting for an answer from the server. |
Instance Variable | _disconnected |
indicate if the connectionLost has been called or not. |
Instance Variable | _getBuffer |
current buffer of data, used to store temporary data when reading in raw mode. |
Instance Variable | _lenExpected |
amount of data expected in raw mode, when reading for a value. |
Inherited from LineReceiver
:
Method | clearLineBuffer |
Clear buffered data. |
Method | dataReceived |
Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.) |
Method | lineLengthExceeded |
Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way. |
Method | setLineMode |
Sets the line-mode of this receiver. |
Method | setRawMode |
Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived. |
Constant | MAX_LENGTH |
The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384. |
Class Variable | delimiter |
The line-ending delimiter to use. By default this is b'\r\n'. |
Instance Variable | line_mode |
Undocumented |
Instance Variable | _buffer |
Undocumented |
Instance Variable | _busyReceiving |
Undocumented |
Inherited from Protocol
(via LineReceiver
):
Method | logPrefix |
Return a prefix matching the class name, to identify log messages related to this protocol instance. |
Class Variable | factory |
Undocumented |
Inherited from BaseProtocol
(via LineReceiver
, Protocol
):
Method | connectionMade |
Called when a connection is made. |
Method | makeConnection |
Make a connection to a transport and a server. |
Instance Variable | connected |
Undocumented |
Instance Variable | transport |
Undocumented |
Inherited from _PauseableMixin
(via LineReceiver
):
Method | pauseProducing |
Undocumented |
Method | resumeProducing |
Undocumented |
Method | stopProducing |
Undocumented |
Instance Variable | paused |
Undocumented |
Inherited from TimeoutMixin
:
Method | callLater |
Wrapper around reactor.callLater for test purpose. |
Method | resetTimeout |
Reset the timeout count down. |
Method | setTimeout |
Change the timeout period |
Method | __timedOut |
Undocumented |
Instance Variable | __timeoutCall |
Undocumented |
Parameters | |
timeOut:int | the timeout to wait before detecting that the connection is dead and close it. It's expressed in seconds. |
Parameters | |
key:bytes | the key to add. |
val:bytes | the value associated with the key. |
flags:int | the flags to store with the key. |
expireTime:int | if different from 0, the relative time in seconds when the key will be deleted from the store. |
Returns | |
Deferred | a deferred that will fire with True if the operation has succeeded, and False with the key already exists. |
Parameters | |
key:bytes | The key to set. |
val:bytes | The value associated with the key. |
cas:bytes | Unique 64-bit value returned by previous call of get. |
flags:int | The flags to store with the key. |
expireTime:int | If different from 0, the relative time in seconds when the key will be deleted from the store. |
Returns | |
Deferred | A deferred that will fire with True if the operation has succeeded, False otherwise. |
Parameters | |
key:bytes | the key to modify. |
val:int | the value to decrement. |
Returns | |
Deferred | a deferred with will be called back with the new value associated with the key (after the decrement). |
Returns | |
Deferred | a deferred that will be called back with True when the operation has succeeded. |
Parameters | |
key:bytes | The key to retrieve. |
withIdentifier:bool | If set to True, retrieve the current identifier along with the value and the flags. |
Returns | |
Deferred | A deferred that will fire with the tuple (flags, value) if withIdentifier is False, or (flags, cas identifier, value) if True. If the server indicates there is no value associated with key, the returned value will be None and the returned flags will be 0. |
Parameters | |
keys:list of bytes | The keys to retrieve. |
withIdentifier:bool | If set to True, retrieve the identifiers along with the values and the flags. |
Returns | |
Deferred | A deferred that will fire with a dictionary with the elements of keys as keys and the tuples (flags, value) as values if withIdentifier is False, or (flags, cas identifier, value) if True. If the server indicates there is no value associated with key, the returned values will be None and the returned flags will be 0. |
Present Since | |
9.0 |
Parameters | |
key:bytes | the key to replace. |
val:bytes | the new value associated with the key. |
flags:int | the flags to store with the key. |
expireTime:int | if different from 0, the relative time in seconds when the key will be deleted from the store. |
Returns | |
Deferred | a deferred that will fire with True if the operation has succeeded, and False with the key didn't previously exist. |
Parameters | |
key:bytes | the key to set. |
val:bytes | the value associated with the key. |
flags:int | the flags to store with the key. |
expireTime:int | if different from 0, the relative time in seconds when the key will be deleted from the store. |
Returns | |
Deferred | a deferred that will fire with True if the operation has succeeded. |
Parameters | |
arg:None or bytes | An optional additional string which will be sent along with the stats command. The interpretation of this value by the server is left undefined by the memcache protocol specification. |
Returns | |
Deferred | a deferred that will fire with a dict of the available statistics. |
Returns | |
Deferred | a deferred that will fire with the string value of the version. |