+ if (memcached_server_response_count(ptr, server_key))
+ memcached_server_response_decrement(ptr, server_key);
+ }
+
+ switch(buffer[0])
+ {
+ case 'V': /* VALUE */
+ return MEMCACHED_SUCCESS;
+ case 'O': /* OK */
+ return MEMCACHED_SUCCESS;
+ case 'S': /* STORED STATS SERVER_ERROR */
+ {
+ if (buffer[2] == 'A') /* STORED STATS */
+ return MEMCACHED_STAT;
+ else if (buffer[1] == 'E')
+ return MEMCACHED_SERVER_ERROR;
+ else if (buffer[1] == 'T')
+ return MEMCACHED_STORED;
+ else
+ return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
+ case 'D': /* DELETED */
+ return MEMCACHED_DELETED;
+ case 'N': /* NOT_FOUND */
+ {
+ if (buffer[4] == 'F')
+ return MEMCACHED_NOTFOUND;
+ else if (buffer[4] == 'S')
+ return MEMCACHED_NOTSTORED;
+ else
+ return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
+ case 'E': /* PROTOCOL ERROR or END */
+ {
+ if (buffer[1] == 'N')
+ return MEMCACHED_END;
+ else if (buffer[1] == 'R')
+ return MEMCACHED_PROTOCOL_ERROR;
+ else
+ return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
+ case 'C': /* CLIENT ERROR */
+ return MEMCACHED_CLIENT_ERROR;
+ default:
+ return MEMCACHED_UNKNOWN_READ_FAILURE;
+
+ }
+
+ return MEMCACHED_SUCCESS;