+ * Fixed bugs in stats output (thread output was wrong)
+ * Clarified MEMCACHED_BAD_KEY_PROVIDED is return for bad prefix key.
+
0.22
* Found a bug in Flags return (Jacek Ostrowski)
* Fixed issue with compiling on Visual Studio
You can set a value which will be used to create a domain for your keys.
The value specified here will be prefixed to each of your keys. The value can not
-be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE and will reduce MEMCACHED_MAX_KEY by
+be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 and will reduce MEMCACHED_MAX_KEY by
the value of your key. The prefix key is only applied to the primary key,
-not the master key.
+not the master key. MEMCACHED_FAILURE will be returned if no key is set. In the case
+of a key which is too long MEMCACHED_BAD_KEY_PROVIDED will be returned.
=item MEMCACHED_CALLBACK_USER_DATA
{
case MEMCACHED_CALLBACK_PREFIX_KEY:
{
- *error= ptr->prefix_key[0] != 0 ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
- return (void *)ptr->prefix_key;
+ if (ptr->prefix_key[0] == 0)
+ {
+ *error= MEMCACHED_FAILURE;
+ return NULL;
+ }
+ else
+ {
+ *error= MEMCACHED_SUCCESS;
+ return (void *)ptr->prefix_key;
+ }
}
case MEMCACHED_CALLBACK_USER_DATA:
{
/* Check the return sizes on FLAGS to make sure it stores 32bit unsigned values correctly */
test_return user_supplied_bug16(memcached_st *memc)
{
- uint32_t x;
memcached_return rc;
char *key= "mykey";
char *value;
assert(rc == MEMCACHED_SUCCESS);
assert(memcmp(value, key, 4) == 0);
+ /* Set to Zero, and then Set to something too large */
+ {
+ char *long_key= "This is more then the allotted number of characters";
+ rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc);
+ assert(rc == MEMCACHED_FAILURE);
+ assert(value == NULL);
+
+ rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key);
+ assert(rc == MEMCACHED_BAD_KEY_PROVIDED);
+ }
+
return MEMCACHED_SUCCESS;
}