Pushing weighted ketama code.
[awesomized/libmemcached] / docs / memcached_behavior.pod
1 =head1 NAME
2
3 memcached_behavior_get memcached_behavior_set
4
5 =head1 LIBRARY
6
7 C Client Library for memcached (libmemcached, -lmemcached)
8
9 =head1 SYNOPSIS
10
11 #include <memcached.h>
12
13 uint64_t
14 memcached_behavior_get (memcached_st *ptr,
15 memcached_behavior flag);
16
17 memcached_return
18 memcached_behavior_set (memcached_st *ptr,
19 memcached_behavior flag,
20 uint64_t data);
21
22 =head1 DESCRIPTION
23
24 libmemcached(3) behavior can be modified by use memcached_behavior_set().
25 Default behavior is the library strives to be quick and accurate. Some
26 behavior, while being faster, can also result in not entirely accurate
27 behavior (for instance, memcached_set() will always respond with
28 C<MEMCACHED_SUCCESS>).
29
30 memcached_behavior_get() takes a behavior flag and returns whether or not
31 that behavior is currently enabled in the client.
32
33 memcached_behavior_set() changes the value of a particular option of the
34 client. It takes both a flag (listed below) and a value. For simple on or
35 off options you just need to pass in a value of 1. Calls to
36 memcached_behavior_set() will flush and reset all connections.
37
38 =over 4
39
40 =item MEMCACHED_BEHAVIOR_NO_BLOCK
41
42 Causes libmemcached(3) to use asychronous IO. This is the fastest transport
43 available for storage functions. For read operations it is currently
44 similar in performance to the non-blocking method (this is being
45 looked into).
46
47 =item MEMCACHED_BEHAVIOR_TCP_NODELAY
48
49 Turns on the no-delay feature for connecting sockets (may be faster in some
50 environments).
51
52 =item MEMCACHED_BEHAVIOR_HASH
53
54 Makes the default hashing algorithm for keys use MD5. The value can be set
55 to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, and MEMCACHED_HASH_FNV1A_32. The behavior for all hashes but MEMCACHED_HASH_DEFAULT is identitical to the Java driver written by Dustin Sallings.
56
57 =item MEMCACHED_BEHAVIOR_DISTRIBUTION
58
59 Using this you can enable different means of distributing values to servers.
60 The default method is MEMCACHED_DISTRIBUTION_MODULA. You can enable
61 consistent hashing by setting MEMCACHED_DISTRIBUTION_CONSISTENT.
62 Consistent hashing delivers better distribution and allows servers to be
63 added to the cluster with minimal cache losses. Currently
64 MEMCACHED_DISTRIBUTION_CONSISTENT is an alias for the value
65 MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA.
66
67 =item MEMCACHED_BEHAVIOR_CACHE_LOOKUPS
68
69 Memcached can cache named lookups so that DNS lookups are made only once.
70
71 =item MEMCACHED_BEHAVIOR_SUPPORT_CAS
72
73 Support CAS operations (this is not enabled by default at this point in the server since it imposes a slight performance penalty).
74
75 =item MEMCACHED_BEHAVIOR_KETAMA
76
77 Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA
78 and the hash to MEMCACHED_HASH_MD5.
79
80 =item MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED
81
82 Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA with the weighted support.
83 and the hash to MEMCACHED_HASH_MD5.
84
85 =item MEMCACHED_BEHAVIOR_KETAMA_HASH
86
87 Sets the hashing algorithm for host mapping on continuum. The value can be set
88 to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, and MEMCACHED_HASH_FNV1A_32.
89
90 =item MEMCACHED_BEHAVIOR_POLL_TIMEOUT
91
92 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.
93
94 =item MEMCACHED_BEHAVIOR_USER_DATA
95
96 This allows you to store a pointer to a specifc piece of data. This can be
97 retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
98
99 will copy the pointer to the clone. This was deprecated in 0.14 in favor
100 of memcached_callback_set(3). This will be removed in 0.15.
101
102 =item MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
103
104 Enabling buffered IO causes commands to "buffer" instead of being sent. Any
105 action that gets data causes this buffer to be be sent to the remote
106 connection. Quiting the connection or closing down the connection will also
107 cause the buffered data to be pushed to the remote connection.
108
109 =item MEMCACHED_BEHAVIOR_VERIFY_KEY
110
111 Enabling this will cause libmemcached(3) to test all keys to verify that they
112 are valid keys.
113
114 =item MEMCACHED_BEHAVIOR_SORT_HOSTS
115
116 Enabling this will cause hosts that are added to be placed in the host list in
117 sorted order. This will defeat consisten hashing.
118
119 =item MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
120
121 In non-blocking mode this changes the value of the timeout during socket
122 connection.
123
124 =back
125
126 =head1 RETURN
127
128 memcached_behavior_get() returns either the current value of the get, or 0
129 or 1 on simple flag behaviors (1 being enabled). memcached_behavior_set()
130 returns failure or success.
131
132 =head1 NOTES
133
134 memcached_behavior_set() in version .17 was changed from taking a pointer
135 to data value, to taking a uin64_t.
136
137 =head1 HOME
138
139 To find out more information please check:
140 L<http://tangent.org/552/libmemcached.html>
141
142 =head1 AUTHOR
143
144 Brian Aker, E<lt>brian@tangent.orgE<gt>
145
146 =head1 SEE ALSO
147
148 memcached(1) libmemcached(3) memcached_strerror(3)
149
150 =cut
151