Fixed memory issue in _stats.
Added interface to externally enable consistent hash.
MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
MEMCACHED_BEHAVIOR_SUPPORT_CAS,
MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
+ MEMCACHED_BEHAVIOR_DISTRIBUTION,
} memcached_behavior;
typedef enum {
case MEMCACHED_BEHAVIOR_TCP_NODELAY:
set_behavior_flag(ptr, MEM_TCP_NODELAY, data);
break;
+ case MEMCACHED_BEHAVIOR_DISTRIBUTION:
+ ptr->distribution= *(memcached_server_distribution *)(data);
+ break;
case MEMCACHED_BEHAVIOR_HASH:
ptr->hash= *(memcached_hash *)(data);
break;
case MEMCACHED_BEHAVIOR_TCP_NODELAY:
temp_flag= MEM_TCP_NODELAY;
break;
+ case MEMCACHED_BEHAVIOR_DISTRIBUTION:
+ return ptr->distribution;
case MEMCACHED_BEHAVIOR_HASH:
return ptr->hash;
case MEMCACHED_BEHAVIOR_KETAMA:
free(stats);
return NULL;
}
- memset(stats, 0, sizeof(memcached_st)*(ptr->number_of_hosts));
+ memset(stats, 0, sizeof(memcached_stat_st)*(ptr->number_of_hosts));
rc= MEMCACHED_SUCCESS;
for (x= 0; x < ptr->number_of_hosts; x++)
return MEMCACHED_SUCCESS;
}
+memcached_return enable_consistent(memcached_st *memc)
+{
+ memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT;
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, &value);
+
+ return MEMCACHED_SUCCESS;
+}
+
memcached_return enable_cas(memcached_st *memc)
{
unsigned int set= 1;
{"unix_socket_nodelay", pre_nodelay, 0, tests},
{"poll_timeout", poll_timeout, 0, tests},
{"gets", enable_cas, 0, tests},
+ {"consistent", enable_consistent, 0, tests},
// {"udp", pre_udp, 0, tests},
{"version_1_2_3", check_for_1_2_3, 0, version_1_2_3},
{"string", 0, 0, string_tests},
Found key bytes_written
Found key limit_maxbytes
Found key threads
+Error 0 -> SUCCESS
+Error 1 -> FAILURE
+Error 2 -> HOSTNAME LOOKUP FAILURE
+Error 3 -> CONNECTION FAILURE
+Error 4 -> CONNECTION BIND FAILURE
+Error 5 -> WRITE FAILURE
+Error 6 -> READ FAILURE
+Error 7 -> UNKNOWN READ FAILURE
+Error 8 -> PROTOCOL ERROR
+Error 9 -> CLIENT ERROR
+Error 10 -> SERVER ERROR
+Error 11 -> CONNECTION SOCKET CREATE FAILURE
+Error 12 -> CONNECTION DATA EXISTS
+Error 13 -> CONNECTION DATA DOES NOT EXIST
+Error 14 -> NOT STORED
+Error 15 -> STORED
+Error 16 -> NOT FOUND
+Error 17 -> MEMORY ALLOCATION FAILURE
+Error 18 -> PARTIAL READ
+Error 19 -> SOME ERRORS WERE REPORTED
+Error 20 -> NO SERVERS DEFINED
+Error 21 -> SERVER END
+Error 22 -> SERVER DELETE
+Error 23 -> SERVER VALUE
+Error 24 -> STAT VALUE
+Error 25 -> SYSTEM ERROR
+Error 26 -> COULD NOT OPEN UNIX SOCKET
+Error 27 -> ACTION NOT SUPPORTED
+Error 28 -> A KEY LENGTH OF ZERO WAS PROVIDED
+Found key pid
+Found key uptime
+Found key time
+Found key version
+Found key pointer_size
+Found key rusage_user
+Found key rusage_system
+Found key curr_items
+Found key total_items
+Found key bytes
+Found key curr_connections
+Found key total_connections
+Found key connection_structures
+Found key cmd_get
+Found key cmd_set
+Found key get_hits
+Found key get_misses
+Found key evictions
+Found key bytes_read
+Found key bytes_written
+Found key limit_maxbytes
+Found key threads
+Found key pid
+Found key uptime
+Found key time
+Found key version
+Found key pointer_size
+Found key rusage_user
+Found key rusage_system
+Found key curr_items
+Found key total_items
+Found key bytes
+Found key curr_connections
+Found key total_connections
+Found key connection_structures
+Found key cmd_get
+Found key cmd_set
+Found key get_hits
+Found key get_misses
+Found key evictions
+Found key bytes_read
+Found key bytes_written
+Found key limit_maxbytes
+Found key threads