Merge in more updates for docs (we are just going to check them all in so that users...
[awesomized/libmemcached] / docs / man / memcached_replace.3
1 .TH "MEMCACHED_REPLACE" "3" "April 07, 2011" "0.47" "libmemcached"
2 .SH NAME
3 memcached_replace \- libmemcached Documentation
4 .
5 .nr rst2man-indent-level 0
6 .
7 .de1 rstReportMargin
8 \\$1 \\n[an-margin]
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
11 -
12 \\n[rst2man-indent0]
13 \\n[rst2man-indent1]
14 \\n[rst2man-indent2]
15 ..
16 .de1 INDENT
17 .\" .rstReportMargin pre:
18 . RS \\$1
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
22 ..
23 .de UNINDENT
24 . RE
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
30 ..
31 .\" Man page generated from reStructeredText.
32 .
33 .sp
34 Store value on server
35 .SH LIBRARY
36 .sp
37 C Client Library for memcached (libmemcached, \-lmemcached)
38 .SH SYNOPSIS
39 .sp
40 .nf
41 .ft C
42 #include <libmemcached/memcached.h>
43
44 memcached_return_t
45 memcached_set (memcached_st *ptr,
46 const char *key, size_t key_length,
47 const char *value, size_t value_length,
48 time_t expiration,
49 uint32_t flags);
50
51 memcached_return_t
52 memcached_add (memcached_st *ptr,
53 const char *key, size_t key_length,
54 const char *value, size_t value_length,
55 time_t expiration,
56 uint32_t flags);
57
58 memcached_return_t
59 memcached_replace (memcached_st *ptr,
60 const char *key, size_t key_length,
61 const char *value, size_t value_length,
62 time_t expiration,
63 uint32_t flags);
64
65 memcached_return_t
66 memcached_prepend(memcached_st *ptr,
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_append(memcached_st *ptr,
74 const char *key, size_t key_length,
75 const char *value, size_t value_length,
76 time_t expiration,
77 uint32_t flags)
78 memcached_return_t
79 memcached_cas(memcached_st *ptr,
80 const char *key, size_t key_length,
81 const char *value, size_t value_length,
82 time_t expiration,
83 uint32_t flags,
84 uint64_t cas);
85
86 memcached_return_t
87 memcached_set_by_key(memcached_st *ptr,
88 const char *master_key, size_t master_key_length,
89 const char *key, size_t key_length,
90 const char *value, size_t value_length,
91 time_t expiration,
92 uint32_t flags);
93
94 memcached_return_t
95 memcached_add_by_key(memcached_st *ptr,
96 const char *master_key, size_t master_key_length,
97 const char *key, size_t key_length,
98 const char *value, size_t value_length,
99 time_t expiration,
100 uint32_t flags);
101
102 memcached_return_t
103 memcached_replace_by_key(memcached_st *ptr,
104 const char *master_key, size_t master_key_length,
105 const char *key, size_t key_length,
106 const char *value, size_t value_length,
107 time_t expiration,
108 uint32_t flags);
109
110 memcached_return_t
111 memcached_prepend_by_key(memcached_st *ptr,
112 const char *master_key, size_t master_key_length,
113 const char *key, size_t key_length,
114 const char *value, size_t value_length,
115 time_t expiration,
116 uint32_t flags);
117
118 memcached_return_t
119 memcached_append_by_key(memcached_st *ptr,
120 const char *master_key, size_t master_key_length,
121 const char *key, size_t key_length,
122 const char *value, size_t value_length,
123 time_t expiration,
124 uint32_t flags);
125
126 memcached_return_t
127 memcached_cas_by_key(memcached_st *ptr,
128 const char *master_key, size_t master_key_length,
129 const char *key, size_t key_length,
130 const char *value, size_t value_length,
131 time_t expiration,
132 uint32_t flags,
133 uint64_t cas);
134 .ft P
135 .fi
136 .SH DESCRIPTION
137 .sp
138 memcached_set(), memcached_add(), and memcached_replace() are all used to
139 store information on the server. All methods take a key, and its length to
140 store the object. Keys are currently limited to 250 characters by the
141 memcached(1) server. You must also supply a value and a length. Optionally you
142 may support an expiration time for the object and a 16 byte value (it is
143 meant to be used as a bitmap).
144 .sp
145 memcached_set() will write an object to the server. If an object already
146 exists it will overwrite what is in the server. If the object does not exist
147 it will be written. If you are using the non\-blocking mode this function
148 will always return true unless a network error occurs.
149 .sp
150 memcached_replace() replaces an object on the server. If the object is not
151 found on the server an error occurs.
152 .sp
153 memcached_add() adds an object to the server. If the object is found on the
154 server an error occurs, otherwise the value is stored.
155 .sp
156 memcached_prepend() places a segment of data before the last piece of data
157 stored. Currently expiration and key are not used in the server.
158 .sp
159 memcached_append() places a segment of data at the end of the last piece of
160 data stored. Currently expiration and key are not used in the server.
161 .sp
162 memcached_cas() overwrites data in the server as long as the "cas" value is
163 still the same in the server. You can get the cas value of a result by
164 calling memcached_result_cas() on a memcached_result_st(3) structure. At the point
165 that this note was written cas is still buggy in memached. Turning on support
166 for it in libmemcached(3) is optional. Please see memcached_set() for
167 information on how to do this.
168 .sp
169 memcached_set_by_key(), memcached_add_by_key(), memcached_replace_by_key(),
170 memcached_prepend_by_key(), memcached_append_by_key_by_key(),
171 memcached_cas_by_key() methods all behave in a similar method as the non key
172 methods. The difference is that they use their master_key parameter to map
173 objects to particular servers.
174 .sp
175 If you are looking for performance, memcached_set() with non\-blocking IO is
176 the fastest way to store data on the server.
177 .sp
178 All of the above functions are supported with the \fBMEMCACHED_BEHAVIOR_USE_UDP\fPbehavior enabled. But when using these operations with this behavior on, there
179 are limits to the size of the payload being sent to the server. The reason for
180 these limits is that the Memcahed Server does not allow multi\-datagram requests
181 and the current server implementation sets a datagram size to 1400 bytes. Due
182 to protocol overhead, the actual limit of the user supplied data is less than
183 1400 bytes and depends on the protocol in use as well as the operation being
184 executed. When running with the binary protocol, \(ga\(ga MEMCACHED_BEHAVIOR_BINARY_PROTOCOL\(ga\(ga,
185 the size of the key,value, flags and expiry combined may not exceed 1368 bytes.
186 When running with the ASCII protocol, the exact limit fluctuates depending on
187 which function is being executed and whether the function is a cas operation
188 or not. For non\-cas ASCII set operations, there are at least 1335 bytes available
189 to split among the key, key_prefix, and value; for cas ASCII operations there are
190 at least 1318 bytes available to split among the key, key_prefix and value. If the
191 total size of the command, including overhead, exceeds 1400 bytes, a \fBMEMCACHED_WRITE_FAILURE\fPwill be returned.
192 .SH RETURN
193 .sp
194 All methods return a value of type \fBmemcached_return_t\fP.
195 On success the value will be \fBMEMCACHED_SUCCESS\fP.
196 Use memcached_strerror() to translate this value to a printable string.
197 .sp
198 For memcached_replace() and memcached_add(), \fBMEMCACHED_NOTSTORED\fP is a
199 legitmate error in the case of a collision.
200 .SH HOME
201 .sp
202 To find out more information please check:
203 \fI\%https://launchpad.net/libmemcached\fP
204 .SH AUTHOR
205 .sp
206 Brian Aker, <\fI\%brian@tangent.org\fP>
207 .SH SEE ALSO
208 .sp
209 memcached(1) libmemached(3) memcached_strerror(3)
210 .SH AUTHOR
211 Brian Aker
212 .SH COPYRIGHT
213 2011, Brian Aker
214 .\" Generated by docutils manpage writer.
215 .\"
216 .