+0.11
+ * Added option to memcache_behavior_set() so that poll() can be timed out.
+
0.10 Tue Nov 20 23:22:31 PST 2007
* Added append binary test.
* Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS behavior so that you can save on
#release versioning
MEMCACHED_MAJOR_VERSION=0
-MEMCACHED_MINOR_VERSION=10
+MEMCACHED_MINOR_VERSION=11
MEMCACHED_MICRO_VERSION=0
#API version
Support CAS operations (this is not enabled by default at this point in the server since it imposes a slight performance penalty).
+=item MEMCACHED_BEHAVIOR_POLL_TIMEOUT
+
+Modify the timeout value that is used by poll(). The default value is -1. An signed int pointer must be passed to memcached_behavior_set() to change this value. For memcached_behavior_get() a signed int value will be cast and returned as the unsigned long long.
+
+
=back
=head1 RETURN
MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
MEMCACHED_BEHAVIOR_SUPPORT_CAS,
+ MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
} memcached_behavior;
typedef enum {
unsigned long long flags;
int send_size;
int recv_size;
+ int32_t poll_timeout;
memcached_string_st result_buffer;
memcached_hash hash;
memcached_return warning; /* Future Use */
}
string_ptr= memcached_string_create(ptr, &ptr->result_buffer, 0);
WATCHPOINT_ASSERT(string_ptr);
+ ptr->poll_timeout= -1;
return ptr;
}
new_clone->number_of_hosts= ptr->number_of_hosts;
new_clone->send_size= ptr->send_size;
new_clone->recv_size= ptr->recv_size;
+ new_clone->poll_timeout= ptr->poll_timeout;
return new_clone;
}
case MEMCACHED_BEHAVIOR_KETAMA:
set_behavior_flag(ptr, MEM_USE_KETAMA, data);
break;
+ case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
+ {
+ unsigned int timeout= (*((unsigned int *)data));
+
+ ptr->poll_timeout= timeout;
+ break;
+ }
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
{
ptr->send_size= (*((int *)data));
case MEMCACHED_BEHAVIOR_KETAMA:
temp_flag= MEM_USE_KETAMA;
break;
+ case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
+ {
+ return (unsigned long long)ptr->poll_timeout;
+ }
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
{
int sock_size;
{
struct pollfd fds[1];
short flags= 0;
+ struct timespec timer;
+ timer.tv_sec= 1;
+ timer.tv_nsec= 0;
if (read_or_write)
flags= POLLOUT | POLLERR;
else
fds[0].fd= ptr->hosts[server_key].fd;
fds[0].events= flags;
- if (poll(fds, 1, -1) < 0)
+ if (poll(fds, 1, ptr->poll_timeout) < 0)
return MEMCACHED_FAILURE;
return MEMCACHED_SUCCESS;
return MEMCACHED_SUCCESS;
}
+memcached_return poll_timeout(memcached_st *memc)
+{
+ int32_t timeout;
+
+ timeout= 100;
+
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, &timeout);
+
+ timeout= (int32_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT);
+
+ assert(timeout == 100);
+
+ return MEMCACHED_SUCCESS;
+}
+
/* Clean the server before beginning testing */
test_st tests[] ={
{"ketama", pre_hash_ketama, 0, tests},
{"unix_socket", pre_unix_socket, 0, tests},
{"unix_socket_nodelay", pre_nodelay, 0, tests},
+ {"poll_timeout", poll_timeout, 0, tests},
{"gets", enable_cas, 0, tests},
// {"udp", pre_udp, 0, tests},
{"version_1_2_3", check_for_1_2_3, 0, version_1_2_3},
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 rusage_user_seconds
+Found key rusage_user_microseconds
+Found key rusage_system_seconds
+Found key rusage_system_microseconds
+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 rusage_user_seconds
+Found key rusage_user_microseconds
+Found key rusage_system_seconds
+Found key rusage_system_microseconds
+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 rusage_user_seconds
+Found key rusage_user_microseconds
+Found key rusage_system_seconds
+Found key rusage_system_microseconds
+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