blib/lib/Memcached/libmemcached/memcached_set.pm

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