4 memcached_response() is used to determine the return result
5 from an issued command.
10 memcached_return
memcached_response(memcached_st
*ptr
,
11 char *buffer
, size_t buffer_length
,
12 unsigned int server_key
)
16 memset(buffer
, 0, buffer_length
);
17 send_length
= read(ptr
->hosts
[server_key
].fd
, buffer
, buffer_length
);
23 return MEMCACHED_SUCCESS
;
25 return MEMCACHED_SUCCESS
;
26 case 'S': /* STORED STATS SERVER_ERROR */
28 if (buffer
[1] == 'T') /* STORED STATS */
29 return MEMCACHED_SUCCESS
;
30 else if (buffer
[1] == 'E')
31 return MEMCACHED_SERVER_ERROR
;
33 return MEMCACHED_UNKNOWN_READ_FAILURE
;
35 case 'D': /* DELETED */
36 return MEMCACHED_SUCCESS
;
37 case 'N': /* NOT_FOUND */
40 return MEMCACHED_NOTFOUND
;
41 else if (buffer
[4] == 'S')
42 return MEMCACHED_NOTSTORED
;
44 return MEMCACHED_UNKNOWN_READ_FAILURE
;
46 case 'E': /* PROTOCOL ERROR */
47 return MEMCACHED_PROTOCOL_ERROR
;
48 case 'C': /* CLIENT ERROR */
49 return MEMCACHED_CLIENT_ERROR
;
51 return MEMCACHED_UNKNOWN_READ_FAILURE
;
54 return MEMCACHED_READ_FAILURE
;