return data ? true : false;
}
-static memcached_return_t set_hash(memcached_hash_t *store, memcached_hash_t type)
-{
-#ifndef HAVE_HSIEH_HASH
- if (type == MEMCACHED_HASH_HSIEH)
- return MEMCACHED_FAILURE;
-#endif
- if (type < MEMCACHED_HASH_MAX)
- {
- *store= type;
- }
- else
- {
- return MEMCACHED_FAILURE;
- }
-
- return MEMCACHED_SUCCESS;
-}
/*
This function is used to modify the behavior of running client.
/* Now we test! */
memcached_ternary_t enabled;
- enabled= cork_switch(instance, true);
+ enabled= test_cork(instance, true);
switch (enabled)
{
return ptr->cached_errno ? MEMCACHED_ERRNO : MEMCACHED_FAILURE ;
case MEM_TRUE:
{
- enabled= cork_switch(instance, false);
+ enabled= test_cork(instance, false);
if (enabled == false) // Possible bug in OS?
{
}
ptr->flags.cork= true;
ptr->flags.tcp_nodelay= true;
+ memcached_quit(ptr); // We go on and reset the connections.
}
break;
case MEM_NOT:
case MEMCACHED_BEHAVIOR_KETAMA:
return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? (uint64_t) 1 : 0;
case MEMCACHED_BEHAVIOR_HASH:
- return ptr->hash;
+ return hashkit_get_function(&ptr->hashkit);
case MEMCACHED_BEHAVIOR_KETAMA_HASH:
- return ptr->distribution_hash;
+ return hashkit_get_function(&ptr->distribution_hashkit);
case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
return ptr->server_failure_limit;
case MEMCACHED_BEHAVIOR_SORT_HOSTS:
memcached_return_t memcached_behavior_set_key_hash(memcached_st *ptr, memcached_hash_t type)
{
- return set_hash(&ptr->hash, type);
+ hashkit_return_t rc;
+ rc= hashkit_set_function(&ptr->hashkit, (hashkit_hash_algorithm_t)type);
+
+ return rc == HASHKIT_SUCCESS ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
}
memcached_hash_t memcached_behavior_get_key_hash(memcached_st *ptr)
{
- return ptr->hash;
+ return (memcached_hash_t)hashkit_get_function(&ptr->hashkit);
}
memcached_return_t memcached_behavior_set_distribution_hash(memcached_st *ptr, memcached_hash_t type)
{
- return set_hash(&ptr->distribution_hash, type);
+ hashkit_return_t rc;
+ rc= hashkit_set_function(&ptr->distribution_hashkit, (hashkit_hash_algorithm_t)type);
+
+ return rc == HASHKIT_SUCCESS ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
}
memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr)
{
- return ptr->distribution_hash;
+ return (memcached_hash_t)hashkit_get_function(&ptr->distribution_hashkit);
}