so I got a question very much related to: question with memcached_get() in libmemcached
it doesn't seem apparent or possible to me from the documentation. is it possible to get a value based on a key without knowing the length of the data? i plan on having multiple threads changing the value of the keys and can't therefore save what the previous length of a value was. I tried setting *value_length to NULL, 0 or an arbitrary high number without effect (eg. program crashed). I was hoping this could be achived with null-terminated strings, but it don't know the internals of libmemcached. any suggestions, pointers? thnx.
char *memcached_get (memcached_st *ptr,
const char *key, size_t key_length,
size_t *value_length,
uint32_t *flags,
memcached_return *error);
some better documentation: http://dev.mysql.com/doc/refman/5.1/en/ha-memcached-interfaces-libmemcached.html#ha-memcached-interfaces-libmemcached-get
ok, thanks to the terrific [/sarcasm] documentation or maybe my inexperience in C++, there has been a misunderstanding regarding the memcached_get function. according to
http://docs.oracle.com/cd/E17952_01/refman-5.0-en/ha-memcached-interfaces-libmemcached.html#ha-memcached-interfaces-libmemcached-get
the function uses size_t *value_length to store the size of the returned value. so write your function like this: