1memcached_append_by_key.pop(3m)emcached_append_by_kmeeymcached_append_by_key.pop(3)
2
3
4
6 memcached_set, memcached_add, memcached_replace - Store value on server
7
9 C Client Library for memcached (libmemcached, -lmemcached)
10
12 #include <memcached.h>
13
14 memcached_return_t
15 memcached_set (memcached_st *ptr,
16 const char *key, size_t key_length,
17 const char *value, size_t value_length,
18 time_t expiration,
19 uint32_t flags);
20
21 memcached_return_t
22 memcached_add (memcached_st *ptr,
23 const char *key, size_t key_length,
24 const char *value, size_t value_length,
25 time_t expiration,
26 uint32_t flags);
27
28 memcached_return_t
29 memcached_replace (memcached_st *ptr,
30 const char *key, size_t key_length,
31 const char *value, size_t value_length,
32 time_t expiration,
33 uint32_t flags);
34
35 memcached_return_t
36 memcached_prepend(memcached_st *ptr,
37 const char *key, size_t key_length,
38 const char *value, size_t value_length,
39 time_t expiration,
40 uint32_t flags)
41
42 memcached_return_t
43 memcached_append(memcached_st *ptr,
44 const char *key, size_t key_length,
45 const char *value, size_t value_length,
46 time_t expiration,
47 uint32_t flags)
48 memcached_return_t
49 memcached_cas(memcached_st *ptr,
50 const char *key, size_t key_length,
51 const char *value, size_t value_length,
52 time_t expiration,
53 uint32_t flags,
54 uint64_t cas);
55
56 memcached_return_t
57 memcached_set_by_key(memcached_st *ptr,
58 const char *master_key, size_t master_key_length,
59 const char *key, size_t key_length,
60 const char *value, size_t value_length,
61 time_t expiration,
62 uint32_t flags);
63
64 memcached_return_t
65 memcached_add_by_key(memcached_st *ptr,
66 const char *master_key, size_t master_key_length,
67 const char *key, size_t key_length,
68 const char *value, size_t value_length,
69 time_t expiration,
70 uint32_t flags);
71
72 memcached_return_t
73 memcached_replace_by_key(memcached_st *ptr,
74 const char *master_key, size_t master_key_length,
75 const char *key, size_t key_length,
76 const char *value, size_t value_length,
77 time_t expiration,
78 uint32_t flags);
79
80 memcached_return_t
81 memcached_prepend_by_key(memcached_st *ptr,
82 const char *master_key, size_t master_key_length,
83 const char *key, size_t key_length,
84 const char *value, size_t value_length,
85 time_t expiration,
86 uint32_t flags);
87
88 memcached_return_t
89 memcached_append_by_key(memcached_st *ptr,
90 const char *master_key, size_t master_key_length,
91 const char *key, size_t key_length,
92 const char *value, size_t value_length,
93 time_t expiration,
94 uint32_t flags);
95
96 memcached_return_t
97 memcached_cas_by_key(memcached_st *ptr,
98 const char *master_key, size_t master_key_length,
99 const char *key, size_t key_length,
100 const char *value, size_t value_length,
101 time_t expiration,
102 uint32_t flags,
103 uint64_t cas);
104
106 memcached_set(), memcached_add(), and memcached_replace() are all used
107 to store information on the server. All methods take a key, and its
108 length to store the object. Keys are currently limited to 250
109 characters by the memcached(1) server. You must also supply a value and
110 a length. Optionally you may support an expiration time for the object
111 and a 16 byte value (it is meant to be used as a bitmap).
112
113 memcached_set() will write an object to the server. If an object
114 already exists it will overwrite what is in the server. If the object
115 does not exist it will be written. If you are using the non-blocking
116 mode this function will always return true unless a network error
117 occurs.
118
119 memcached_replace() replaces an object on the server. If the object is
120 not found on the server an error occurs.
121
122 memcached_add() adds an object to the server. If the object is found on
123 the server an error occurs, otherwise the value is stored.
124
125 memcached_prepend() places a segment of data before the last piece of
126 data stored. Currently expiration and key are not used in the server.
127
128 memcached_append() places a segment of data at the end of the last
129 piece of data stored. Currently expiration and key are not used in the
130 server.
131
132 memcached_cas() overwrites data in the server as long as the "cas"
133 value is still the same in the server. You can get the cas value of a
134 result by calling memcached_result_cas() on a memcached_result_st(3)
135 structure. At the point that this note was written cas is still buggy
136 in memached. Turning on support for it in libmemcached(3) is optional.
137 Please see memcached_set() for information on how to do this.
138
139 memcached_set_by_key(), memcached_add_by_key(),
140 memcached_replace_by_key(), memcached_prepend_by_key(),
141 memcached_append_by_key_by_key(), memcached_cas_by_key() methods all
142 behave in a similar method as the non key methods. The difference is
143 that they use their master_key parameter to map objects to particular
144 servers.
145
146 If you are looking for performance, memcached_set() with non-blocking
147 IO is the fastest way to store data on the server.
148
149 All of the above functions are supported with the
150 "MEMCACHED_BEHAVIOR_USE_UDP" behavior enabled. But when using these
151 operations with this behavior on, there are limits to the size of the
152 payload being sent to the server. The reason for these limits is that
153 the Memcahed Server does not allow multi-datagram requests and the
154 current server implementation sets a datagram size to 1400 bytes. Due
155 to protocol overhead, the actual limit of the user supplied data is
156 less than 1400 bytes and depends on the protocol in use as well as the
157 operation being executed. When running with the binary protocol, "
158 MEMCACHED_BEHAVIOR_BINARY_PROTOCOL", the size of the key,value, flags
159 and expiry combined may not exceed 1368 bytes. When running with the
160 ASCII protocol, the exact limit fluctuates depending on which function
161 is being executed and whether the function is a cas operation or not.
162 For non-cas ASCII set operations, there are at least 1335 bytes
163 available to split among the key, key_prefix, and value; for cas ASCII
164 operations there are at least 1318 bytes available to split among the
165 key, key_prefix and value. If the total size of the command, including
166 overhead, exceeds 1400 bytes, a "MEMCACHED_WRITE_FAILURE" will be
167 returned.
168
170 All methods return a value of type "memcached_return_t". On success
171 the value will be "MEMCACHED_SUCCESS". Use memcached_strerror() to
172 translate this value to a printable string.
173
174 For memcached_replace() and memcached_add(), "MEMCACHED_NOTSTORED" is a
175 legitmate error in the case of a collision.
176
178 To find out more information please check:
179 <https://launchpad.net/libmemcached>
180
182 Brian Aker, <brian@tangent.org>
183
185 memcached(1) libmemached(3) memcached_strerror(3)
186
187
188
189 2010-06-28 memcached_append_by_key.pop(3)