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
)
15 memset(buffer
, 0, buffer_length
);
16 send_length
= read(ptr
->fd
, buffer
, buffer_length
);
22 return MEMCACHED_SUCCESS
;
24 return MEMCACHED_SUCCESS
;
25 case 'S': /* STORED STATS SERVER_ERROR */
27 if (buffer
[1] == 'T') /* STORED STATS */
28 return MEMCACHED_SUCCESS
;
29 else if (buffer
[1] == 'E')
30 return MEMCACHED_SERVER_ERROR
;
32 return MEMCACHED_UNKNOWN_READ_FAILURE
;
34 case 'D': /* DELETED */
35 return MEMCACHED_SUCCESS
;
36 case 'N': /* NOT_FOUND */
39 return MEMCACHED_NOTFOUND
;
40 else if (buffer
[4] == 'S')
41 return MEMCACHED_NOTSTORED
;
43 return MEMCACHED_UNKNOWN_READ_FAILURE
;
45 case 'E': /* PROTOCOL ERROR */
46 return MEMCACHED_PROTOCOL_ERROR
;
47 case 'C': /* CLIENT ERROR */
48 return MEMCACHED_CLIENT_ERROR
;
50 return MEMCACHED_UNKNOWN_READ_FAILURE
;
53 return MEMCACHED_READ_FAILURE
;