memcached_clone(&memc, clone);
WATCHPOINT;
}
- memcached_result_st *fetch_result()
- {
- memcached_return rc;
- return memcached_fetch_result(&memc, &result, &rc);
- }
- /*
-
- memcached_return fetch_execute(
- memcached_return ((*callback[]))(&memc,
- &result,
- void *context,
- unsigned in number_of_callbacks))
- {
- return memcached_fetch_execute(&memc,
- (*callback[])(&memc, &result, context,
- number_of_callbacks));
- }
- */
char *fetch (char *key, size_t *key_length, size_t *value_length)
{
uint32_t flags;
(uint32_t)0,
cas);
}
- // Ok, so how do I have a 'delete' method, delete being a keyword?
- memcached_return delete(char *key)
+ // using 'remove' vs. 'delete' since 'delete' is a keyword
+ memcached_return remove(char *key)
{
return memcached_delete (&memc, key, strlen(key), (time_t)0);
return 0;
}
+uint8_t increment_test(memcached_st *memc)
+{
+ Memcached mcach;
+ memcached_return rc;
+ char *key= "inctest";
+ char *inc_value= "1";
+ char *ret_value;
+ uint64_t int_inc_value;
+ uint64_t int_ret_value;
+ size_t value_length;
+
+ mcach.set(key, inc_value, strlen(inc_value));
+ ret_value= mcach.get(key, &value_length);
+ printf("\nretvalue %s\n",ret_value);
+ int_inc_value= atoi(inc_value);
+ int_ret_value= atoi(ret_value);
+ assert(int_ret_value == int_inc_value);
+
+ rc= mcach.increment(key, 1, &int_ret_value);
+ assert(rc == MEMCACHED_SUCCESS);
+ assert(int_ret_value == 2);
+
+ rc= mcach.increment(key, 1, &int_ret_value);
+ assert(rc == MEMCACHED_SUCCESS);
+ assert(int_ret_value == 3);
+
+ rc= mcach.increment(key, 5, &int_ret_value);
+ assert(rc == MEMCACHED_SUCCESS);
+ assert(int_ret_value == 8);
+
+ return 0;
+}
+
uint8_t basic_master_key_test(memcached_st *memc)
{
Memcached foo;
test_st tests[] ={
{"basic", 0, basic_test },
+ {"basic", 0, increment_test },
{"basic_master_key", 0, basic_master_key_test },
{0, 0, 0}
};