~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to docs/man/memcached_fetch_execute.3

Merging bzr://gaz.tangent.org/libmemcached/build/ to Build branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH "MEMCACHED_FETCH_EXECUTE" "3" "March 14, 2012" "1.0.5" "libmemcached"
 
2
.SH NAME
 
3
memcached_fetch_execute \- Retrieving data from the server
 
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
.SH SYNOPSIS
 
34
.sp
 
35
#include <libmemcached/memcached.h>
 
36
.INDENT 0.0
 
37
.TP
 
38
.B memcached_result_st * memcached_fetch_result(memcached_st\fI\ *ptr\fP, memcached_result_st\fI\ *result\fP, memcached_return_t\fI\ *error\fP)
 
39
.UNINDENT
 
40
.INDENT 0.0
 
41
.TP
 
42
.B char * memcached_get(memcached_st\fI\ *ptr\fP, const char\fI\ *key\fP, size_t\fI\ key_length\fP, size_t\fI\ *value_length\fP, uint32_t\fI\ *flags\fP, memcached_return_t\fI\ *error\fP)
 
43
.UNINDENT
 
44
.INDENT 0.0
 
45
.TP
 
46
.B memcached_return_t memcached_mget(memcached_st\fI\ *ptr\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP)
 
47
.UNINDENT
 
48
.INDENT 0.0
 
49
.TP
 
50
.B char * memcached_get_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char\fI\ *key\fP, size_t\fI\ key_length\fP, size_t\fI\ *value_length\fP, uint32_t\fI\ *flags\fP, memcached_return_t\fI\ *error\fP)
 
51
.UNINDENT
 
52
.INDENT 0.0
 
53
.TP
 
54
.B memcached_return_t memcached_mget_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP)
 
55
.UNINDENT
 
56
.INDENT 0.0
 
57
.TP
 
58
.B memcached_return_t memcached_fetch_execute(memcached_st\fI\ *ptr\fP, \fI\%memcached_execute_fn\fP\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
 
59
.UNINDENT
 
60
.INDENT 0.0
 
61
.TP
 
62
.B memcached_return_t memcached_mget_execute(memcached_st\fI\ *ptr\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP, \fI\%memcached_execute_fn\fP\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
 
63
.UNINDENT
 
64
.INDENT 0.0
 
65
.TP
 
66
.B memcached_return_t memcached_mget_execute_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP, \fI\%memcached_execute_fn\fP\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
 
67
.UNINDENT
 
68
.INDENT 0.0
 
69
.TP
 
70
.B memcached_return_t (*memcached_execute_fn)(const memcached_st\fI\ *ptr\fP, memcached_result_st\fI\ *result\fP, void\fI\ *context\fP)
 
71
.UNINDENT
 
72
.sp
 
73
Compile and link with \-lmemcached
 
74
.SH DESCRIPTION
 
75
.sp
 
76
\fI\%memcached_get()\fP is used to fetch an individual value from the server.
 
77
You must pass in a key and its length to fetch the object. You must supply
 
78
three pointer variables which will give you the state of the returned
 
79
object.  A \fBuint32_t\fP pointer to contain whatever flags you stored with the value, a \fBsize_t\fP pointer which will be filled with size of of
 
80
the object, and a \fBmemcached_return_t\fP pointer to hold any error. The
 
81
object will be returned upon success and NULL will be returned on failure. Any
 
82
object returned by \fI\%memcached_get()\fP must be released by the caller
 
83
application.
 
84
.sp
 
85
\fI\%memcached_mget()\fP is used to select multiple keys at once. For
 
86
multiple key operations it is always faster to use this function. This function always works asynchronously.
 
87
.sp
 
88
To retrieve data after a successful execution of \fI\%memcached_mget()\fP, you will need to
 
89
call \fI\%memcached_fetch_result()\fP.  You should continue to call this function until
 
90
it returns a NULL (i.e. no more values). If you need to quit in the middle of a
 
91
\fI\%memcached_mget()\fP call, you can execute a \fBmemcached_quit()\fP, those this is not required.
 
92
.sp
 
93
\fI\%memcached_fetch_result()\fP is used to fetch an individual value from the server. \fI\%memcached_mget()\fP must always be called before using this method.
 
94
You must pass in a key and its length to fetch the object. You must supply
 
95
three pointer variables which will give you the state of the returned
 
96
object.  A \fBuint32_t\fP pointer to contain whatever flags you stored with the value, a \fBsize_t\fP pointer which will be filled with size of of the
 
97
object, and a \fBmemcached_return_t\fP pointer to hold any error. The
 
98
object will be returned upon success and NULL will be returned on failure. \fBMEMCACHED_END\fP is returned by the *error value when all objects that have been found are returned. The final value upon \fBMEMCACHED_END\fP is null.
 
99
.sp
 
100
\fI\%memcached_fetch_result()\fP is used to return a \fBmemcached_result_st\fP structure from a memcached server. The result object is forward compatible
 
101
with changes to the server. For more information please refer to the
 
102
\fBmemcached_result_st\fP help. This function will dynamically allocate a
 
103
result structure for you if you do not pass one to the function.
 
104
.sp
 
105
\fI\%memcached_fetch_execute()\fP is a callback function for result sets.
 
106
Instead of returning the results to you for processing, it passes each of the
 
107
result sets to the list of functions you provide. It passes to the function
 
108
a \fBmemcached_st\fP that can be cloned for use in the called
 
109
function (it can not be used directly). It also passes a result set which does
 
110
not need to be freed. Finally it passes a "context". This is just a pointer to
 
111
a memory reference you supply the calling function. Currently only one value
 
112
is being passed to each function call. In the future there will be an option
 
113
to allow this to be an array.
 
114
.sp
 
115
\fI\%memcached_mget_execute()\fP and \fI\%memcached_mget_execute_by_key()\fP
 
116
is similar to \fI\%memcached_mget()\fP, but it may trigger the supplied
 
117
callbacks with result sets while sending out the queries. If you try to
 
118
perform a really large multiget with \fI\%memcached_mget()\fP you may
 
119
encounter a deadlock in the OS kernel (it will fail to write data to the
 
120
socket because the input buffer is full). \fI\%memcached_mget_execute()\fP
 
121
solves this problem by processing some of the results before continuing
 
122
sending out requests. Please note that this function is only available in
 
123
the binary protocol.
 
124
.sp
 
125
\fI\%memcached_get_by_key()\fP and \fI\%memcached_mget_by_key()\fP behave
 
126
in a similar nature as \fI\%memcached_get()\fP and \fI\%memcached_mget()\fP.
 
127
The difference is that they take a master key that is used for determining
 
128
which server an object was stored if key partitioning was used for storage.
 
129
.sp
 
130
All of the above functions are not tested when the
 
131
\fBMEMCACHED_BEHAVIOR_USE_UDP\fP has been set. Executing any of these
 
132
functions with this behavior on will result in \fBMEMCACHED_NOT_SUPPORTED\fP being returned, or for those functions which do not return a \fBmemcached_return_t\fP, the error function parameter will be set to \fBMEMCACHED_NOT_SUPPORTED\fP.
 
133
.SH RETURN
 
134
.sp
 
135
All objects retrieved via \fI\%memcached_get()\fP or \fI\%memcached_get_by_key()\fP must be freed with \fIfree(3)\fP.
 
136
.sp
 
137
\fI\%memcached_get()\fP will return NULL on
 
138
error. You must look at the value of error to determine what the actual error
 
139
was.
 
140
.sp
 
141
\fI\%memcached_fetch_execute()\fP return \fBMEMCACHED_SUCCESS\fP if
 
142
all keys were successful. \fBMEMCACHED_NOTFOUND\fP will be return if no
 
143
keys at all were found.
 
144
.sp
 
145
\fI\%memcached_fetch_result()\fP sets error
 
146
to \fBMEMCACHED_END\fP upon successful conclusion.
 
147
\fBMEMCACHED_NOTFOUND\fP will be return if no keys at all were found.
 
148
.SH HOME
 
149
.sp
 
150
To find out more information please check:
 
151
\fI\%http://libmemcached.org/\fP
 
152
.SH SEE ALSO
 
153
.sp
 
154
\fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
 
155
.SH AUTHOR
 
156
Brian Aker
 
157
.SH COPYRIGHT
 
158
2011, Brian Aker DataDifferential, http://datadifferential.com/
 
159
.\" Generated by docutils manpage writer.
 
160
.\" 
 
161
.