line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Memcached::libmemcached; |
2
|
|
|
|
|
|
|
|
3
|
31
|
|
|
31
|
|
747841
|
use warnings; |
|
31
|
|
|
|
|
75
|
|
|
31
|
|
|
|
|
1275
|
|
4
|
31
|
|
|
31
|
|
165
|
use strict; |
|
31
|
|
|
|
|
49
|
|
|
31
|
|
|
|
|
1775
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Memcached::libmemcached - Thin fast full interface to the libmemcached client API |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 1.001800 (with libmemcached-1.0.18 embedded) |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '1.001800'; # also alter in pod above |
17
|
|
|
|
|
|
|
|
18
|
31
|
|
|
31
|
|
178
|
use Carp; |
|
31
|
|
|
|
|
60
|
|
|
31
|
|
|
|
|
3074
|
|
19
|
31
|
|
|
31
|
|
192
|
use base qw(Exporter); |
|
31
|
|
|
|
|
52
|
|
|
31
|
|
|
|
|
4021
|
|
20
|
|
|
|
|
|
|
|
21
|
31
|
|
|
31
|
|
14023
|
use Memcached::libmemcached::API; |
|
31
|
|
|
|
|
72
|
|
|
31
|
|
|
|
|
18049
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
23
|
|
|
|
|
|
|
libmemcached_functions(), |
24
|
|
|
|
|
|
|
libmemcached_constants(), |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
our %EXPORT_TAGS = libmemcached_tags(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
require XSLoader; |
29
|
|
|
|
|
|
|
XSLoader::load('Memcached::libmemcached', $VERSION); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use Memcached::libmemcached; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$memc = memcached_create(); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
memcached_server_add($memc, "localhost"); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
memcached_set($memc, $key, $value); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$value = memcached_get($memc, $key); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Memcached::libmemcached is a very thin, highly efficient, wrapper around the |
46
|
|
|
|
|
|
|
libmemcached library. It's implemented almost entirely in C. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
It gives full access to the rich functionality offered by libmemcached. |
49
|
|
|
|
|
|
|
libmemcached is fast, light on memory usage, thread safe, and provide full |
50
|
|
|
|
|
|
|
access to server side methods. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
- Synchronous and Asynchronous support. |
53
|
|
|
|
|
|
|
- TCP and Unix Socket protocols. |
54
|
|
|
|
|
|
|
- A half dozen or so different hash algorithms. |
55
|
|
|
|
|
|
|
- Implementations of the new cas, replace, and append operators. |
56
|
|
|
|
|
|
|
- Man pages written up on entire API. |
57
|
|
|
|
|
|
|
- Implements both modulo and consistent hashing solutions. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
(Memcached::libmemcached is fairly new and not all the functions in |
60
|
|
|
|
|
|
|
libmemcached have perl interfaces yet. It's usually trivial to add functions - |
61
|
|
|
|
|
|
|
just a few lines in libmemcached.xs, a few lines of documentation, and a few |
62
|
|
|
|
|
|
|
lines of testing. Volunteers welcome!) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The libmemcached library documentation (which is bundled with this module) |
65
|
|
|
|
|
|
|
serves as the primary reference for the functionality. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This documentation provides summary of the functions, along with any issues |
68
|
|
|
|
|
|
|
specific to this perl interface, and references to the documentation for the |
69
|
|
|
|
|
|
|
corresponding functions in the underlying library. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
For more information on libmemcached, see L |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 CONVENTIONS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 Terminology |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The term "memcache" is used to refer to the C structure at the |
78
|
|
|
|
|
|
|
heart of the libmemcached library. We'll use $memc to represent this |
79
|
|
|
|
|
|
|
structure in perl code. (The libmemcached library documentation uses C.) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 Traditional and Object-Oriented |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
There are two ways to use the functionality offered by this module: |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
B<*> You can import the functions you want to use and call them explicitly. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
B<*> Or, you can use $memc as an object and call most of the functions as methods. |
88
|
|
|
|
|
|
|
You can do that for any function that takes a $memc (ptr) as its first |
89
|
|
|
|
|
|
|
argument, which is almost all of them. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Since the primary focus of this module is to be a thin wrapper around |
92
|
|
|
|
|
|
|
libmemcached, the bulk of this documentation describes the traditional |
93
|
|
|
|
|
|
|
functional interface. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The object-oriented interface is mainly targeted at modules wishing to subclass |
96
|
|
|
|
|
|
|
Memcached::libmemcached, such as Cache::Memcached::libmemcached. For more information |
97
|
|
|
|
|
|
|
see L. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 Function Names and Arguments |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The function names in the libmemcached library have exactly the same names in |
102
|
|
|
|
|
|
|
Memcached::libmemcached. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The function arguments are also the same as the libmemcached library and |
105
|
|
|
|
|
|
|
documentation, with two exceptions: |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
B<*> There are no I arguments. Wherever the libmemcached documentation |
108
|
|
|
|
|
|
|
shows a length argument (input or output) the corresponding argument doesn't |
109
|
|
|
|
|
|
|
exist in the Perl API because it's not needed. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
B<*> Some arguments are optional. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Many libmemcached function arguments are I |
114
|
|
|
|
|
|
|
address of the value that the function will modify. For these the perl function |
115
|
|
|
|
|
|
|
will modify the argument directly if it can. For example, in this call: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$value = memcached_get($memc, $key, $flags, $rc); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The $flags and $rc arguments are output values that are modified by the |
120
|
|
|
|
|
|
|
memcached_get() function. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See the L section for the fine detail of how each argument type |
123
|
|
|
|
|
|
|
is handled. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 Return Status |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Most of the functions return an integer status value. This is shown as |
128
|
|
|
|
|
|
|
C in the libmemcached documentation. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
In the perl interface this value is I returned directly. Instead a simple |
131
|
|
|
|
|
|
|
boolean is returned: true for 'success', defined but false for some |
132
|
|
|
|
|
|
|
'unsuccessful' conditions like 'not found', and undef for all other cases (i.e., errors). |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
All the functions documented below return this simple boolean value unless |
135
|
|
|
|
|
|
|
otherwise indicated. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The actual C integer value, and corresponding error message, |
138
|
|
|
|
|
|
|
for the last libmemcached function call can be accessed via the |
139
|
|
|
|
|
|
|
L method. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 Unimplemented Functions |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Functions relating to managing lists of servers (memcached_server_push, and |
144
|
|
|
|
|
|
|
memcached_server_list) have not been implemented because they're not needed and |
145
|
|
|
|
|
|
|
likely to be deprecated by libmemcached. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Functions relating to iterating through results (memcached_result_*) have not |
148
|
|
|
|
|
|
|
been implemented yet. They're not a priority because similar functionality is |
149
|
|
|
|
|
|
|
available via the callbacks. See L. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 EXPORTS |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
All the public functions in libmemcached are available for import. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
All the public constants and enums in libmemcached are also available for import. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Exporter tags are defined for each enum. This allows you to import groups of |
160
|
|
|
|
|
|
|
constants easily. For example, to enable consistent hashing you could use: |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
use Memcached::libmemcached qw(:memcached_behavior :memcached_server_distribution); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
memcached_behavior_set($memc, MEMCACHED_BEHAVIOR_DISTRIBUTION(), MEMCACHED_DISTRIBUTION_CONSISTENT()); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The L module allows patterns in the import list, so to import all the |
167
|
|
|
|
|
|
|
functions, for example, you can use: |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
use Memcached::libmemcached qw(/^memcached/); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Refer to L for a full list of the available |
172
|
|
|
|
|
|
|
constants and the tags they are grouped by. To see a list of all available |
173
|
|
|
|
|
|
|
functions and constants you can execute: |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
perl -MMemcached::libmemcached -le 'print $_ for @Memcached::libmemcached::EXPORT_OK' |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 FUNCTIONS |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 Functions For Managing Memcaches |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head3 memcached_create |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my $memc = memcached_create(); |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Creates and returns a 'memcache' that represents the state of |
186
|
|
|
|
|
|
|
communication with a set of memcached servers. |
187
|
|
|
|
|
|
|
See L. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head3 memcached_clone |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
my $memc = memcached_clone(undef, undef); |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
XXX Not currently recommended for use. |
194
|
|
|
|
|
|
|
See L. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head3 memcached_free |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
memcached_free($memc); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Frees the memory associated with $memc. |
201
|
|
|
|
|
|
|
After calling it $memc can't be used. |
202
|
|
|
|
|
|
|
See L. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head3 memcached_server_count |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
$server_count= memcached_server_count($memc); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Returns a count of the number of servers |
209
|
|
|
|
|
|
|
associated with $memc. |
210
|
|
|
|
|
|
|
See L. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head3 memcached_server_add |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head3 memcached_server_add_with_weight |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
memcached_server_add($memc, $hostname, $port); |
217
|
|
|
|
|
|
|
memcached_server_add_with_weight($memc, $hostname, $port, $weight); |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Adds details of a single memcached server (accessed via TCP/IP) to $memc. |
220
|
|
|
|
|
|
|
See L. The default weight is 0. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head3 memcached_server_add_unix_socket |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head3 memcached_server_add_unix_socket_with_weight |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
memcached_server_add_unix_socket($memc, $socket_path); |
227
|
|
|
|
|
|
|
memcached_server_add_unix_socket_with_weight($memc, $socket_path); |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Adds details of a single memcached server (accessed via a UNIX domain socket) to $memc. |
230
|
|
|
|
|
|
|
See L. The default weight is 0. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head3 memcached_behavior_set |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
memcached_behavior_set($memc, $option_key, $option_value); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Changes the value of a particular option. |
237
|
|
|
|
|
|
|
See L. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head3 memcached_behavior_get |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
memcached_behavior_get($memc, $option_key); |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Get the value of a particular option. |
244
|
|
|
|
|
|
|
See L. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head3 memcached_callback_set |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
memcached_callback_set($memc, $flag, $value); |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Set callback flag value. |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
The only flag currently supported is C. |
253
|
|
|
|
|
|
|
The $value must be less than MEMCACHED_PREFIX_KEY_MAX_SIZE (eg 128) bytes. |
254
|
|
|
|
|
|
|
It also can't be empty L |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head3 memcached_callback_get |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
$value = memcached_callback_set($memc, $flag, $return_status); |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Get callback flag value. Sets return status in $return_status. |
261
|
|
|
|
|
|
|
The only flag currently supported is C. |
262
|
|
|
|
|
|
|
Returns undef on error. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=cut |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 Functions for Setting Values |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
See L. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head3 memcached_set |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
memcached_set($memc, $key, $value); |
274
|
|
|
|
|
|
|
memcached_set($memc, $key, $value, $expiration, $flags); |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Set $value as the value of $key. |
277
|
|
|
|
|
|
|
$expiration and $flags are both optional and default to 0. |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head3 memcached_add |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
memcached_add($memc, $key, $value); |
282
|
|
|
|
|
|
|
memcached_add($memc, $key, $value, $expiration, $flags); |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Like L except that an error is returned if $key I already |
285
|
|
|
|
|
|
|
stored in the server. |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head3 memcached_replace |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
memcached_replace($memc, $key, $value); |
290
|
|
|
|
|
|
|
memcached_replace($memc, $key, $value, $expiration, $flags); |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Like L except that an error is returned if $key I already |
293
|
|
|
|
|
|
|
error is returned. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head3 memcached_prepend |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
memcached_prepend($memc, $key, $value); |
298
|
|
|
|
|
|
|
memcached_prepend($memc, $key, $value, $expiration, $flags); |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Prepend $value to the value of $key. $key must already exist. |
301
|
|
|
|
|
|
|
$expiration and $flags are both optional and default to 0. |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head3 memcached_append |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
memcached_append($memc, $key, $value); |
306
|
|
|
|
|
|
|
memcached_append($memc, $key, $value, $expiration, $flags); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
Append $value to the value of $key. $key must already exist. |
309
|
|
|
|
|
|
|
$expiration and $flags are both optional and default to 0. |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head3 memcached_cas |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
memcached_cas($memc, $key, $value, $expiration, $flags, $cas) |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Overwrites data in the server stored as $key as long as $cas |
316
|
|
|
|
|
|
|
still has the same value in the server. |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Cas is still buggy in memached. Turning on support for it in libmemcached is |
319
|
|
|
|
|
|
|
optional. Please see memcached_behavior_set() for information on how to do this. |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
XXX and the memcached_result_cas() function isn't implemented yet |
322
|
|
|
|
|
|
|
so you can't get the $cas to use. |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=cut |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head2 Functions for Fetching Values |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
See L. |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
The memcached_fetch_result() and |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=head3 memcached_get |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
$value = memcached_get($memc, $key); |
335
|
|
|
|
|
|
|
$value = memcached_get($memc, $key, $flags, $rc); |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
Get and return the value of $key. Returns undef on error. |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
Also updates $flags to the value of the flags stored with $value, |
340
|
|
|
|
|
|
|
and updates $rc with the return code. |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head3 memcached_mget |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
memcached_mget($memc, \@keys); |
346
|
|
|
|
|
|
|
memcached_mget($memc, \%keys); |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
Triggers the asynchronous fetching of multiple keys at once. For multiple key |
349
|
|
|
|
|
|
|
operations it is always faster to use this function. You I then use |
350
|
|
|
|
|
|
|
memcached_fetch() or memcached_fetch_result() to retrieve any keys found. |
351
|
|
|
|
|
|
|
No error is given on keys that are not found. |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
Instead of this function, you'd normally use the L method. |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=head3 memcached_fetch |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
$value = memcached_fetch($memc, $key); |
358
|
|
|
|
|
|
|
$value = memcached_fetch($memc, $key, $flag, $rc); |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
Fetch the next $key and $value pair returned in response to a memcached_mget() call. |
361
|
|
|
|
|
|
|
Returns undef if there are no more values. |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
If $flag is given then it will be updated to whatever flags were stored with the value. |
364
|
|
|
|
|
|
|
If $rc is given then it will be updated to the return code. |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
This is similar to L except its fetching the results from the previous |
367
|
|
|
|
|
|
|
call to L and $key is an output parameter instead of an input. |
368
|
|
|
|
|
|
|
Usually you'd just use the L method instead. |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=cut |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=head2 Functions for Incrementing and Decrementing Values |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
memcached servers have the ability to increment and decrement unsigned integer keys |
376
|
|
|
|
|
|
|
(overflow and underflow are not detected). This gives you the ability to use |
377
|
|
|
|
|
|
|
memcached to generate shared sequences of values. |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
See L. |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=head3 memcached_increment |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
memcached_increment( $key, $offset, $new_value_out ); |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
Increments the integer value associated with $key by $offset and returns the |
386
|
|
|
|
|
|
|
new value in $new_value_out. |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=head3 memcached_decrement |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
memcached_decrement( $key, $offset, $new_value_out ); |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
Decrements the integer value associated with $key by $offset and returns the |
393
|
|
|
|
|
|
|
new value in $new_value_out. |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head3 memcached_increment_with_initial |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
memcached_increment_with_initial( $key, $offset, $initial, $expiration, $new_value_out ); |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
Increments the integer value associated with $key by $offset and returns the |
400
|
|
|
|
|
|
|
new value in $new_value_out. |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
If the object specified by key does not exist, one of two things may happen: |
403
|
|
|
|
|
|
|
If the expiration value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. |
404
|
|
|
|
|
|
|
For all other expiration values, the operation will succeed by seeding the |
405
|
|
|
|
|
|
|
value for that key with a initial value to expire with the provided expiration time. |
406
|
|
|
|
|
|
|
The flags will be set to zero. |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=head3 memcached_decrement_with_initial |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
memcached_decrement_with_initial( $key, $offset, $initial, $expiration, $new_value_out ); |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
Decrements the integer value associated with $key by $offset and returns the |
413
|
|
|
|
|
|
|
new value in $new_value_out. |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
If the object specified by key does not exist, one of two things may happen: |
416
|
|
|
|
|
|
|
If the expiration value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. |
417
|
|
|
|
|
|
|
For all other expiration values, the operation will succeed by seeding the |
418
|
|
|
|
|
|
|
value for that key with a initial value to expire with the provided expiration time. |
419
|
|
|
|
|
|
|
The flags will be set to zero. |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=head3 memcached_increment_by_key |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=head3 memcached_decrement_by_key |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=head3 memcached_increment_with_initial_by_key |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=head3 memcached_decrement_with_initial_by_key |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
These are the master key equivalents of the above. They all take an extra |
430
|
|
|
|
|
|
|
initial $master_key parameter. |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=head2 Functions for Deleting Values from memcached |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
See L. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head3 memcached_delete |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
memcached_delete($memc, $key); |
440
|
|
|
|
|
|
|
memcached_delete($memc, $key, $expiration); |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
Delete $key. If $expiration is greater than zero then the key is deleted by |
443
|
|
|
|
|
|
|
memcached after that many seconds. |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=cut |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head2 Functions for Accessing Statistics from memcached |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
Not yet implemented. See L. |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
See L. |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=cut |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=head2 Miscellaneous Functions |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=head2 memcached_lib_version |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
$version = memcached_lib_version() |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
Returns a simple version string, like "1.0.17", representing the libmemcached |
464
|
|
|
|
|
|
|
version (version of the client library, not server). |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head2 memcached_version |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
$version = memcached_version($memc) |
469
|
|
|
|
|
|
|
($version1, $version2, $version3) = memcached_version($memc) |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
Returns the I version of all the memcached servers. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
In scalar context returns a simple version string, like "1.2.3". |
474
|
|
|
|
|
|
|
In list context returns the individual version component numbers. |
475
|
|
|
|
|
|
|
Returns an empty list if there was an error. |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
Note that the return value differs from that of the underlying libmemcached |
478
|
|
|
|
|
|
|
library memcached_version() function. |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=cut |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub memcached_version { |
483
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
484
|
|
|
|
|
|
|
|
485
|
0
|
|
|
|
|
|
my @versions; |
486
|
|
|
|
|
|
|
# XXX should be rewritten to use underlying memcached_version then |
487
|
|
|
|
|
|
|
# return the lowest cached version from the server structures |
488
|
|
|
|
|
|
|
$self->walk_stats('', sub { |
489
|
0
|
|
|
0
|
|
|
my ($key, $value, $hostport) = @_; |
490
|
0
|
0
|
|
|
|
|
push @versions, [ split /\./, $value ] if $key eq 'version'; |
491
|
0
|
|
|
|
|
|
return; |
492
|
0
|
|
|
|
|
|
}); |
493
|
|
|
|
|
|
|
|
494
|
0
|
0
|
0
|
|
|
|
my $lowest = (sort { |
495
|
0
|
|
|
|
|
|
$a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] |
496
|
|
|
|
|
|
|
} @versions)[0]; |
497
|
|
|
|
|
|
|
|
498
|
0
|
0
|
|
|
|
|
return join '.', @$lowest unless wantarray; |
499
|
0
|
|
|
|
|
|
return @$lowest; |
500
|
|
|
|
|
|
|
} |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head2 memcached_verbosity |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
memcached_verbosity($memc, $verbosity) |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
Modifies the "verbosity" of the memcached servers associated with $memc. |
508
|
|
|
|
|
|
|
See L. |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
=head3 memcached_flush |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
memcached_flush($memc, $expiration); |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
Wipe clean the contents of associated memcached servers. |
515
|
|
|
|
|
|
|
See L. |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=head2 memcached_quit |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
memcached_quit($memc) |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
Disconnect from all currently connected servers and reset libmemcached state associated with $memc. |
522
|
|
|
|
|
|
|
Not normally called explicitly. |
523
|
|
|
|
|
|
|
See L. |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=head3 memcached_strerror |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
$string = memcached_strerror($memc, $return_code) |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
memcached_strerror() takes a C value and returns a string describing the error. |
530
|
|
|
|
|
|
|
The string should be treated as read-only (it may be so in future versions). |
531
|
|
|
|
|
|
|
See also L. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
This function is rarely needed in the Perl interface because the return code is |
534
|
|
|
|
|
|
|
a I that already contains the error string. |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=cut |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=head2 Grouping Keys On Servers |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
Normally libmemcached hashes the $key value to select which memcached server to |
541
|
|
|
|
|
|
|
communicate with. If you have several keys relating to a single object then |
542
|
|
|
|
|
|
|
it's very likely that the corresponding values will be stored in different |
543
|
|
|
|
|
|
|
memcached servers. |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
It would be more efficient, in general, when setting and getting multiple |
546
|
|
|
|
|
|
|
related values, if it was possible to specify a different value to be hashed to |
547
|
|
|
|
|
|
|
select which memcached server to communicate with. With libmemcached, you can. |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
Most of the functions for setting and getting values have C<*_by_key> variants |
550
|
|
|
|
|
|
|
for exactly this reason. These all have an extra $master_key parameter |
551
|
|
|
|
|
|
|
immediately after the $memc parameter. For example: |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
memcached_mget($memc, \%keys, \%dest); |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
memcached_mget_by_key($memc, $maskey_key, \%keys, \%dest); |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
The C<*_by_key> variants all work in exactly the same way as the corresponding |
558
|
|
|
|
|
|
|
plain function, except that libmemcached hashes $master_key instead of $key to |
559
|
|
|
|
|
|
|
which memcached server to communicate with. |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
If $master_key is undef then the functions behave the same as their non-by-key |
562
|
|
|
|
|
|
|
variants, i.e., $key is used for hashing. |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
By-key variants of L: |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=head3 memcached_get_by_key |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
=head3 memcached_mget_by_key |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
By-key variants of L: |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=head3 memcached_set_by_key |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=head3 memcached_replace_by_key |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=head3 memcached_add_by_key |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
=head3 memcached_append_by_key |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=head3 memcached_cas_by_key |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head3 memcached_prepend_by_key |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=head3 memcached_delete_by_key |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=head1 OBJECT-ORIENTED INTERFACE |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
=head2 Methods |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=head3 new |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
$memc = $class->new; # same as memcached_create() |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
=head3 errstr |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
$errstr = $memc->errstr; |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
Returns the error message and code from the most recent call to any |
599
|
|
|
|
|
|
|
libmemcached function that returns a C, which most do. |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
The return value is a I, like $!, which means it has separate numeric |
602
|
|
|
|
|
|
|
and string values. The numeric value is the memcached_return integer value, |
603
|
|
|
|
|
|
|
and the string value is the corresponding error message what memcached_strerror() |
604
|
|
|
|
|
|
|
would return. |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
As a special case, if the memcached_return is MEMCACHED_ERRNO, indicating a |
607
|
|
|
|
|
|
|
system call error, then the string returned by strerror() is appended. |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
This method is also currently callable as memcached_errstr() for compatibility |
610
|
|
|
|
|
|
|
with an earlier version, but that deprecated alias will start warning and then |
611
|
|
|
|
|
|
|
cease to exist in future versions. |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=head3 mget_into_hashref |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
$memc->mget_into_hashref( \@keys, \%dest_hash); # keys from array |
616
|
|
|
|
|
|
|
$memc->mget_into_hashref( \%keys, \%dest_hash); # keys from hash |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
Combines memcached_mget() and a memcached_fetch() loop into a single highly |
619
|
|
|
|
|
|
|
efficient call. |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
Fetched values are stored in \%dest_hash, updating existing values or adding |
622
|
|
|
|
|
|
|
new ones as appropriate. |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
This method is also currently callable as memcached_mget_into_hashref() for |
625
|
|
|
|
|
|
|
compatibility with an earlier version, but that deprecated alias will start |
626
|
|
|
|
|
|
|
warning and then cease to exist in future versions. |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=head3 get_multi |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
$hash_ref = $memc->get_multi( @keys ); |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
Effectively the same as: |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
$memc->mget_into_hashref( \@keys, $hash_ref = { } ) |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
So it's very similar to L but less efficient for large |
637
|
|
|
|
|
|
|
numbers of keys (because the keys have to be pushed onto the argument stack) |
638
|
|
|
|
|
|
|
and less flexible (because you can't add/update elements into an existing hash). |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
This method is provided to optimize subclasses that want to provide a |
641
|
|
|
|
|
|
|
Cache::Memcached compatible API with maximum efficiency. |
642
|
|
|
|
|
|
|
Note, however, that C does I support the L |
643
|
|
|
|
|
|
|
feature where a key can be a reference to an array [ $master_key, $key ]. |
644
|
|
|
|
|
|
|
Use L directly if you need that feature. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=head3 get |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
$value = $memc->get( $key ); |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
Effectively the same as: |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
$value = memcached_get( $memc, $key ); |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
The C method also supports the L feature where $key can |
655
|
|
|
|
|
|
|
be a reference to an array [ $master_key, $key ]. In which case the call is |
656
|
|
|
|
|
|
|
effectively the same as: |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
$value = memcached_get_by_key( $memc, $key->[0], $key->[1] ) |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
=head3 set_callback_coderefs |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
$memc->set_callback_coderefs(\&set_callback, \&get_callback); |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
This interface is I and I. (It's also currently |
666
|
|
|
|
|
|
|
used by Cache::Memcached::libmemcached, so don't use it if you're using that module.) |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
Specify functions which will be executed when values are set and/or get using $memc. |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
When the callbacks are executed $_ is the value and the arguments are the key |
671
|
|
|
|
|
|
|
and flags value. Both $_ and the flags may be modified. |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
Currently the functions must return an empty list. |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
This method is also currently callable as memcached_set_callback_coderefs() for |
676
|
|
|
|
|
|
|
compatibility with an earlier version, but that deprecated alias will start |
677
|
|
|
|
|
|
|
warning and then cease to exist in future versions. |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=head3 walk_stats |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
$memc->walk_stats( $stats_args, \&my_stats_callback ); |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
This interface is I and I. |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
Calls the memcached_stat_execute() function to issue a "STAT $stats_args" command to |
686
|
|
|
|
|
|
|
the connected memcached servers. The $stats_args argument is usually an empty string. |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
The callback function is called for each return value from each server. |
689
|
|
|
|
|
|
|
The callback will be passed at least these parameters: |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
sub my_stats_callback { |
692
|
|
|
|
|
|
|
my ($key, $value, $hostport) = @_; |
693
|
|
|
|
|
|
|
# Do what you like with the above! |
694
|
|
|
|
|
|
|
return; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
Currently the callback I return an empty list. |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
Prior to version 0.4402 the callback was passed a fourth argument which was a |
700
|
|
|
|
|
|
|
copy of the $stats_args value. That is no longer the case. As a I aid |
701
|
|
|
|
|
|
|
to migration, the C method does C and |
702
|
|
|
|
|
|
|
passes C<$_> as the forth argument. That will work so long as the code in the |
703
|
|
|
|
|
|
|
callback doesn't alter C<$_>. If your callback code requires $stats_args you |
704
|
|
|
|
|
|
|
should change it to be a closure instead. |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=head2 trace_level |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
$memc->trace_level($trace_level); |
709
|
|
|
|
|
|
|
$trace_level = $memc->trace_level; |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
Sets the trace level (see L). Returns the previous trace level. |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
=head3 get_server_for_key |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
$memc->get_server_for_key( $key ) |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
This method uses I to get information about which server should contain |
718
|
|
|
|
|
|
|
the specified $key. |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
It returns a string containing the hostname:port of the appropriate server, or undef on failure. |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
=head1 EXTRA INFORMATION |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=head2 Tracing Execution |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
$memc->trace_level($trace_level); |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
If set >= 1 then any non-success memcached_return value will be logged via warn(). |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
If set >= 2 or more then some data types will list conversions of input and output values for function calls. |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
The C environment variable provides a default. |
733
|
|
|
|
|
|
|
The value is read when L is called. |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
=head2 Type Mapping |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
For pointer arguments, undef is mapped to null on input and null is mapped to |
738
|
|
|
|
|
|
|
undef on output. |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
XXX expand with details from typemap file |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=head2 Deprecated Functions |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
The following functions are available but deprecated in this release. |
745
|
|
|
|
|
|
|
In the next release they'll generate warnings. |
746
|
|
|
|
|
|
|
In a future release they'll be removed. |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=head3 memcached_errstr |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Use L instead. |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=head3 memcached_mget_into_hashref |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
Use L instead. |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
=head3 memcached_set_callback_coderefs |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
Use L instead. |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=head1 AUTHOR EMERITUS |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
Tim Bunce, C<< >> with help from Patrick Galbraith and Daisuke Maki. |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
L |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=head1 CURRENT MAINTAINER |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
Matthew Horsfall (alh) C<< >> |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
Daisuke Maki C<< >> with occasional bursts of input from Tim Bunce. |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Larry Wall for Perl, Brad Fitzpatrick for memcached, Brian Aker for libmemcached, |
775
|
|
|
|
|
|
|
and Patrick Galbraith and Daisuke Maki for helping with the implementation. |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
=head1 PORTABILITY |
778
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
See Slaven Rezic's excellent CPAN Testers Matrix at L |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
Along with Dave Cantrell's excellent CPAN Dependency tracker at |
782
|
|
|
|
|
|
|
L |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=head1 BUGS |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
Please report any bugs or feature requests to the GitHub issue tracker at |
787
|
|
|
|
|
|
|
L. |
788
|
|
|
|
|
|
|
We will be notified, and then you'll automatically be notified of progress on |
789
|
|
|
|
|
|
|
your bug as we make changes. |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
The source is hosted at github: L |
794
|
|
|
|
|
|
|
Patches and volunteers always welcome. |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
Copyright 2008 Tim Bunce, All Rights Reserved. |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
801
|
|
|
|
|
|
|
under the same terms as Perl itself. |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=cut |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
1; # End of Memcached::libmemcached |