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 or END */
49 return MEMCACHED_NOTFOUND
;
50 else if (buffer
[1] == 'R')
51 return MEMCACHED_PROTOCOL_ERROR
;
53 return MEMCACHED_UNKNOWN_READ_FAILURE
;
55 case 'C': /* CLIENT ERROR */
56 return MEMCACHED_CLIENT_ERROR
;
58 return MEMCACHED_UNKNOWN_READ_FAILURE
;
61 return MEMCACHED_READ_FAILURE
;