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
)
17 memset(buffer
, 0, buffer_length
);
23 unsigned int read_length
;
25 read_length
= memcached_io_read(ptr
, server_key
,
29 return MEMCACHED_UNKNOWN_READ_FAILURE
;
31 if (*buffer_ptr
== '\n')
40 return MEMCACHED_SUCCESS
;
42 return MEMCACHED_SUCCESS
;
43 case 'S': /* STORED STATS SERVER_ERROR */
45 if (buffer
[1] == 'T') /* STORED STATS */
46 return MEMCACHED_SUCCESS
;
47 else if (buffer
[1] == 'E')
48 return MEMCACHED_SERVER_ERROR
;
50 return MEMCACHED_UNKNOWN_READ_FAILURE
;
52 case 'D': /* DELETED */
53 return MEMCACHED_DELETED
;
54 case 'N': /* NOT_FOUND */
57 return MEMCACHED_NOTFOUND
;
58 else if (buffer
[4] == 'S')
59 return MEMCACHED_NOTSTORED
;
61 return MEMCACHED_UNKNOWN_READ_FAILURE
;
63 case 'E': /* PROTOCOL ERROR or END */
67 else if (buffer
[1] == 'R')
68 return MEMCACHED_PROTOCOL_ERROR
;
70 return MEMCACHED_UNKNOWN_READ_FAILURE
;
72 case 'C': /* CLIENT ERROR */
73 return MEMCACHED_CLIENT_ERROR
;
75 return MEMCACHED_UNKNOWN_READ_FAILURE
;
79 return MEMCACHED_SUCCESS
;