This repository was archived by the owner on Feb 13, 2022. It is now read-only.
Open
Conversation
Owner
|
Hi Barret, thank you very much for your contribution. I will find some time to review this by the end of the week. If you could write some tests for the multi_get query would be awesome. Otherwise I would try to do it at the weekend, too. Regards, Tim |
Author
|
I am having trouble running the test suit itself (pointing it to my external box). I can't connect to my external box. I can telnet to it, I can connect to it in my personal server, but I can't run the test suite.... :-S So, I'm just going to paste it below. exports['multi_get'] = function(beforeExit) {
var n = 0;
mc.set('multi_A', 'A', function(err, response) {
assert.equal(response, 'STORED');
n++;
mc.set('multi_B', 'B', function(err, response) {
assert.equal(response, 'STORED');
n++;
mc.set('multi_C', 'C', function(err, response) {
assert.equal(response, 'STORED');
n++;
var expectedOutput = {multi_A: 'A', multi_B: 'B', multi_C: 'C'};
// allow for string with spaces
mc.get('A B C', function(err, response) {
n++;
assert.equal(response, expectedOutput);
});
// allow for array of items
mc.get(['A', 'B', 'C'], function(err, response) {
n++;
assert.equal(response, expectedOutput);
});
// return only values that exist
mc.get(['A', 'B', 'C', '_no_exist_key'], function(err, response) {
n++;
assert.equal(response, expectedOutput);
});
// if an array is given, return a {} at a minimum
mc.get(['does_not_exist_A', 'does_not_exist_B'], function(err, response) {
n++;
assert.equal(response, {});
});
// memcached server should return an error
mx.get([], function(err, response) {
n++;
assert.equal(error, 'ERROR');
});
// memcached server should return an error
mx.get('', function(err, response) {
n++;
assert.equal(error, 'ERROR');
});
});
});
});
beforeExit(function() {
assert.equal(9, n);
});
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memcached supports multiple keys in a get query. I added a handler to support this feature and thought you would find it useful.
I changed the
exports.getmethod to accomodate arrays or strings with spaces. The handler for the multiple key get followed the same pattern as the regular get handler.The major difference, to me, is that I am specifically looking for the end tag position and not trying to figure it out according to the length given. This would not be fun to calculate for a multiple key get query. The
crlfvalue is present in all the responses. I used thecrlfas something to key on.Any questions or places that I can fill in, let me know!
Best,
Barret
Ps. Thank you for making this a simple to follow node module. I appreciate it.