1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
4 TEST_CASE("memcached_touch") {
5 auto test
= MemcachedCluster::mixed();
6 auto memc
= &test
.memc
;
8 auto binary
= GENERATE(0, 1);
10 test
.enableBinaryProto(binary
);
12 DYNAMIC_SECTION("touch binary=" << binary
) {
13 REQUIRE_FALSE(memcached_get(memc
, S(__func__
), nullptr, nullptr, &rc
));
14 REQUIRE_RC(MEMCACHED_NOTFOUND
, rc
);
16 REQUIRE_SUCCESS(memcached_set(memc
, S(__func__
), S(__func__
), 2, 0));
18 Malloced
val(memcached_get(memc
, S(__func__
), nullptr, nullptr, &rc
));
22 REQUIRE_SUCCESS(memcached_touch(memc
, S(__func__
), 60));
23 val
= memcached_get(memc
, S(__func__
), nullptr, nullptr, &rc
);
27 REQUIRE_SUCCESS(memcached_touch(memc
, S(__func__
), time(nullptr) - 2));
28 val
= memcached_get(memc
, S(__func__
), nullptr, nullptr, &rc
);
29 REQUIRE_RC(MEMCACHED_NOTFOUND
, rc
);
33 DYNAMIC_SECTION("touch_by_key binary=" << binary
) {
34 REQUIRE_RC(MEMCACHED_NOTFOUND
, memcached_touch_by_key(memc
, S(__func__
), S(__func__
), 60));
35 REQUIRE_SUCCESS(memcached_set_by_key(memc
, S(__func__
), S(__func__
), S(__func__
), 2, 0));
37 Malloced
val(memcached_get_by_key(memc
, S(__func__
), S(__func__
), nullptr, nullptr, &rc
));
41 REQUIRE_SUCCESS(memcached_touch_by_key(memc
, S(__func__
), S(__func__
), time(nullptr) - 2));
42 val
= memcached_get_by_key(memc
, S(__func__
), S(__func__
), nullptr, nullptr, &rc
);
43 REQUIRE_RC(MEMCACHED_NOTFOUND
, rc
);
46 REQUIRE_RC(MEMCACHED_NOTFOUND
, memcached_touch_by_key(memc
, S(__func__
), S(__func__
), 60));