0.16
* Work on the UDP protocol
+ * Added get_by_key, set_by_key tests for C++ API
0.15 Tue Jan 29 14:55:44 PST 2008
* More work on the C++ API.
value_length, &flags, &rc);
}
- char *get_by_key(char *key, char *master_key, size_t *value_length)
+ char *get_by_key(char *master_key, char *key, size_t *value_length)
{
uint32_t flags;
memcached_return rc;
- return memcached_get_by_key(&memc, key, strlen(key), master_key, strlen(master_key),
+ return memcached_get_by_key(&memc, master_key, strlen(master_key), key, strlen(key),
value_length, &flags, &rc);
}
return 0;
}
+uint8_t basic_master_key_test(memcached_st *memc)
+{
+ Memcached foo;
+ char *value_set= "Data for server A";
+ char *master_key_a= "server-a";
+ char *master_key_b= "server-b";
+ char *key= "xyz";
+ char *value;
+ size_t value_length;
+
+ foo.set_by_key(master_key_a, key, value_set, strlen(value_set));
+ value= foo.get_by_key(master_key_a, key, &value_length);
+
+ assert((memcmp(value, value_set, value_length) == 0));
+
+ value= foo.get_by_key(master_key_b, key, &value_length);
+ assert((memcmp(value, value_set, value_length) == 0));
+
+ return 0;
+}
+
test_st tests[] ={
{"basic", 0, basic_test },
+ {"basic_master_key", 0, basic_master_key_test },
{0, 0, 0}
};