Reputation: 41
I have a following simple memcache code:::::
memcached_return *rc = NULL;
char *sur = "SURBHI";
memcached_set(cacheClient, "SB", strlen("SB"), sur, strlen(sur), (time_t)0, (uint32_t)0);
char *value1;
memcached_get(cacheClient, "SB", strlen("SB"), 6, (uint32_t)0, rc);
The call to memcache_get gives segmentation fault. Debugger gave following:
Did anyone faced similar issue, or has any idea about the solution?
Upvotes: 0
Views: 987
Reputation: 665
The last three parameters of memcached_get
should be the pointers through which you will get informations like value, length and error code. See below:
char *key = "key";
size_t value_length;
memcached_return_t ret;
uint32_t flags;
char *value = memcached_get(memc, key, strlen(key), &value_length, &flags, &ret);
if (ret == MEMCACHED_SUCCESS) {
// ok
} else {
// error
}
Upvotes: 1