class Client extends Client

Memcache-Client

Constants

DELIMITER

Text lines are always terminated by \r\n. Unstructured data is also terminated by \r\n, even though \r, \n or any other 8-bit characters may also appear inside the data. Therefore, when a client retrieves data from a server, it must use the length of the data block (which it will be provided with) to determine where the data block ends, and not the fact that \r\n follows the end of the data block, even though it does.

ERROR

"ERROR\r\n"

means the client sent a nonexistent command name.

CLIENT_ERROR

"CLIENT_ERROR \r\n"

means some sort of client error in the input line, i.e. the input doesn't conform to the protocol in some way. is a human-readable error string.

SERVER_ERROR

"SERVER_ERROR \r\n"

means some sort of server error prevents the server from carrying out the command. is a human-readable error string. In cases of severe server errors, which make it impossible to continue serving the client (this shouldn't normally happen), the server will close the connection after sending the error line. This is the only case in which the server closes a connection to a client.

STORED

"STORED\r\n", to indicate success.

NOT_STORED

"NOT_STORED\r\n" to indicate the data was not stored, but not because of an error. This normally means that the condition for an "add" or a "replace" command wasn't met.

EXISTS

"EXISTS\r\n" to indicate that the item you are trying to store with a "cas" command has been modified since you last fetched it.

NOT_FOUND

"NOT_FOUND\r\n" to indicate that the item you are trying to store with a "cas" command did not exist.

TOUCHED

"TOUCHED\r\n" to indicate success

DELETED

"DELETED\r\n" to indicate success

VERSION

Antwort und Befehl; Unterscheidet sich nur im Case Siehe Funktion getVersion()

OK

"OK\r\n" in response (unless "noreply" is given as the last parameter)

END

END

QUIT

Befehl

SET

Befehl

ADD

Befehl

FLUSH_ALL

Befehl

REPLACE

Befehl

APPEND

Befehl

PREPEND

Befehl

DELETE

Befehl

TOUCH

Befehl

GET

Befehl

GETS

Mehrere Keys

VALUE

Rückantwort

Methods

string
sendStorageCommandAndReceive(string $command, string $key, string $data, integer $expireTime = null, integer $flags = 0, boolean $noReply = false)

sendStorageCommandAndReceive

$this
sendRetrievalCommand(string $command, string $key)

Senden von get-Anfragen

array
parseStandardAnswer(type $response)

Internes Verarbeiten der Standard-Antworten

string
delete(string $key)

Eintrag löschen

boolean|Map
parseValuesAnswer(type $response)

Antwort parsen

Map
get(string $key)

Wert holen

string
prepend(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert um die Daten ergänzen

string
append(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert um die Daten ergänzen

string
add(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen, wenn er nocht nicht gesetzt wurde

string
replace(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen nur dann, wenn der Wert bereits existiert

string
set(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen

string
touch(string $key, integer $expireTime = null)

touch

string
flushAll($delay = null)

FLUSH ALL

string
getVersion()

Memcached-Server-Version

$this
quit()

Verbindung trennen

string
getResponse()

Ergebnis vom Server

Details

at line 222
protected string sendStorageCommandAndReceive(string $command, string $key, string $data, integer $expireTime = null, integer $flags = 0, boolean $noReply = false)

sendStorageCommandAndReceive

[noreply]\r\n cas [noreply]\r\n

"set" means "store this data".

"add" means "store this data, but only if the server doesn't already hold data for this key".

"replace" means "store this data, but only if the server does already hold data for this key".

"append" means "add this data to an existing key after existing data".

"prepend" means "add this data to an existing key before existing data".

"noreply" optional parameter instructs the server to not send the reply. NOTE: if the request line is malformed, the server can't parse "noreply" option reliably. In this case it may send the error to the client, and not reading it on the client side will break things. Client should construct only valid requests.

Parameters

string $command is "set", "add", "replace", "append" or "prepend"
string $key
string $data
integer $expireTime null or 0 never expired
integer $flags
boolean $noReply

Return Value

string Ergebnis

Exceptions

MissingKeyException
MissingCommandException

at line 275
protected $this sendRetrievalCommand(string $command, string $key)

Senden von get-Anfragen

Parameters

string $command
string $key

Return Value

$this

Exceptions

MissingKeyException
MissingCommandException

at line 304
protected array parseStandardAnswer(type $response)

Internes Verarbeiten der Standard-Antworten

Parameters

type $response

Return Value

array

Exceptions

ProtocolException

at line 339
string delete(string $key)

Eintrag löschen

Parameters

string $key

Return Value

string

Exceptions

ProtocolException

at line 366
protected boolean|Map parseValuesAnswer(type $response)

Antwort parsen

Parameters

type $response

Return Value

boolean|Map

Exceptions

ProtocolException

at line 407
Map get(string $key)

Wert holen

Mehrere Werte können durch leerzeichen übergeben werden.

Parameters

string $key

Return Value

Map

at line 433
string prepend(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert um die Daten ergänzen

"prepend" means "add this data to an existing key before existing data".

Parameters

string $key
string $data
integer $expireTime
integer $flags

Return Value

string

Exceptions

ProtocolException

at line 451
string append(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert um die Daten ergänzen

"append" means "add this data to an existing key after existing data".

Parameters

string $key
string $data
integer $expireTime
integer $flags

Return Value

string

Exceptions

ProtocolException

at line 469
string add(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen, wenn er nocht nicht gesetzt wurde

"add" means "store this data, but only if the server doesn't already hold data for this key".

Parameters

string $key
string $data
integer $expireTime
integer $flags

Return Value

string

Exceptions

ProtocolException

at line 487
string replace(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen nur dann, wenn der Wert bereits existiert

"replace" means "store this data, but only if the server does already hold data for this key".

Parameters

string $key
string $data
integer $expireTime
integer $flags

Return Value

string

Exceptions

ProtocolException

at line 505
string set(string $key, string $data, integer $expireTime = null, integer $flags = null)

Wert setzen

"set" means "store this data".

Parameters

string $key
string $data
integer $expireTime
integer $flags

Return Value

string

Exceptions

ProtocolException

at line 519
string touch(string $key, integer $expireTime = null)

touch

Parameters

string $key
integer $expireTime

Return Value

string

Exceptions

ProtocolException

at line 545
string flushAll($delay = null)

FLUSH ALL

Parameters

$delay

Return Value

string

Exceptions

ProtocolException

at line 569
string getVersion()

Memcached-Server-Version

Return Value

string

Exceptions

ProtocolException

at line 587
$this quit()

Verbindung trennen

Return Value

$this

at line 598
protected string getResponse()

Ergebnis vom Server

Return Value

string