Skip to content
This repository

Add support for GETS #12

Merged
merged 1 commit into from almost 2 years ago

2 participants

Cameron Erik Frey
Cameron
cjc commented

Small change to add support for the "gets" alias of "get" commands, with test.

Equivalent to the change that went into kestrel recently (twitter/kestrel@d1c93cb)

Erik Frey

Thanks for submitting this!

gets isn't an alias for get exactly. It's supposed to also return a CAS value that you can use for synchronization. I'd have expected a memcache client that issued gets to error if the response doesn't have a CAS value.

On the other hand, you're absolutely right that Kestrel is doing this, and I don't see any complaints there. I'll go ahead and merge this change, but I may remove it in the future if it's causing problems.

Erik Frey erikfrey merged commit 38b15e4 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 25, 2012
Cameron cjc Add support for GETS alias for GET requests 8052c3f
This page is out of date. Refresh to see the latest.

Showing 2 changed files with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  src/net/request.cpp
  2. +12 0 tests/request.cpp
2  src/net/request.cpp
@@ -44,7 +44,7 @@ request_grammar::request_grammar()
44 44 >> qi::uint_ [phoenix::ref(req.wait_ms) = qi::_1]
45 45 );
46 46
47   - get = lit("get ") [phoenix::ref(req.type) = request::RT_GET]
  47 + get = (lit("get ")|lit("gets ")) [phoenix::ref(req.type) = request::RT_GET]
48 48 >> key_name [phoenix::ref(req.queue) = qi::_1]
49 49 >> *get_option;
50 50
12 tests/request.cpp
@@ -46,6 +46,18 @@ BOOST_FIXTURE_TEST_CASE( test_get, fixtures::basic_request )
46 46 BOOST_REQUIRE_EQUAL(request_.wait_ms, 500);
47 47 }
48 48
  49 +// test that we get some options correctly for a gets
  50 +BOOST_FIXTURE_TEST_CASE( test_gets, fixtures::basic_request )
  51 +{
  52 + BOOST_REQUIRE(parser_.parse(request_, string("gets bar+woof/t=700/close/open\r\n")));
  53 + BOOST_REQUIRE_EQUAL(request_.type, darner::request::RT_GET);
  54 + BOOST_REQUIRE_EQUAL(request_.queue, "bar+woof");
  55 + BOOST_REQUIRE(request_.get_open);
  56 + BOOST_REQUIRE(request_.get_close);
  57 + BOOST_REQUIRE(!request_.get_abort);
  58 + BOOST_REQUIRE_EQUAL(request_.wait_ms, 700);
  59 +}
  60 +
49 61 // test that reparsing clears fields that were previously set
50 62 BOOST_FIXTURE_TEST_CASE( test_reparse, fixtures::basic_request )
51 63 {

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.