Skip to content
This repository was archived by the owner on Feb 13, 2022. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/memcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ Client.prototype.handle_get = function(buffer) {
return [result_value, end_indicator_len + crlf_len];
} else if (buffer.indexOf('VALUE') == 0 && buffer.indexOf('END') != -1) {
first_line_len = buffer.indexOf(crlf) + crlf_len;
var end_indicator_start = buffer.indexOf('END');
result_len = end_indicator_start - first_line_len - crlf_len;
var end_indicator_start = buffer.lastIndexOf(crlf + 'END' + crlf);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, there is no way to retrieve multiple values with a single get request, so looking for the last instance of crlf + "END" + crlf should be fine. However, if I am misinterpreting, and the code needs to be able to handle multiple VALUE...END pieces, let me know and I will change lastIndexOf() to indexOf()

result_len = end_indicator_start - first_line_len;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the index retrieved on the above line now includes a crlf, there is no need to subtract the crlf_len.

result_value = buffer.substr(first_line_len, result_len);
return [result_value, first_line_len + parseInt(result_len, 10) + crlf_len + end_indicator_len + crlf_len]
} else {
Expand Down