.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Memcached::libmemcached::memcached_get 3pm" .TH Memcached::libmemcached::memcached_get 3pm "2018-11-01" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" memcached_get, memcached_mget, memcached_fetch, memcached_mget_execute, memcached_mget_execute_by_key \- Get a value .SH "LIBRARY" .IX Header "LIBRARY" C Client Library for memcached (libmemcached, \-lmemcached) .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& memcached_result_st * \& memcached_fetch_result (memcached_st *ptr, \& memcached_result_st *result, \& memcached_return_t *error); \& \& char * \& memcached_get (memcached_st *ptr, \& const char *key, size_t key_length, \& size_t *value_length, \& uint32_t *flags, \& memcached_return_t *error); \& \& memcached_return_t \& memcached_mget (memcached_st *ptr, \& const char * const *keys, \& const size_t *key_length, \& size_t number_of_keys); \& char * \& memcached_get_by_key (memcached_st *ptr, \& const char *master_key, size_t master_key_length, \& const char *key, size_t key_length, \& size_t *value_length, \& uint32_t *flags, \& memcached_return_t *error); \& \& memcached_return_t \& memcached_mget_by_key (memcached_st *ptr, \& const char *master_key, size_t master_key_length, \& const char * const *keys, \& const size_t *key_length, \& size_t number_of_keys); \& \& char * \& memcached_fetch (memcached_st *ptr, \& char *key, size_t *key_length, \& size_t *value_length, \& uint32_t *flags, \& memcached_return_t *error); \& \& memcached_return_t \& memcached_fetch_execute (memcached_st *ptr, \& memcached_execute_fn *callback, \& void *context, \& uint32_t number_of_callbacks); \& \& \& memcached_return_t \& memcached_mget_execute (memcached_st *ptr, \& const char * const *keys, \& const size_t *key_length, \& size_t number_of_keys, \& memcached_execute_fn *callback, \& void *context, \& uint32_t number_of_callbacks); \& \& memcached_return_t \& memcached_mget_execute_by_key (memcached_st *ptr, \& const char *master_key, \& size_t master_key_length, \& const char * const *keys, \& const size_t *key_length, \& size_t number_of_keys, \& memcached_execute_fn *callback, \& void *context, \& uint32_t number_of_callbacks); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBmemcached_get()\fR is used to fetch an individual value from the server. You must pass in a key and its length to fetch the object. You must supply three pointer variables which will give you the state of the returned object. A uint32_t pointer to contain whatever flags you stored with the value, a size_t pointer which will be filled with size of of the object, and a memcached_return_t pointer to hold any error. The object will be returned upon success and \s-1NULL\s0 will be returned on failure. Any object returned by \&\fBmemcached_get()\fR must be released by the caller application. .PP \&\fBmemcached_mget()\fR is used to select multiple keys at once. For multiple key operations it is always faster to use this function. This function always works asynchronously. \fBmemcached_fetch()\fR is then used to retrieve any keys found. No error is given on keys that are not found. You must call either \&\fBmemcached_fetch()\fR or \fBmemcached_fetch_result()\fR after a successful call to \&\fBmemcached_mget()\fR. You should continue to call these functions until they return \s-1NULL\s0 (aka no more values). If you need to quit in the middle of a \&\fBmemcached_get()\fR call, execute a \fBmemcached_quit()\fR. After you do this, you can issue new queries against the server. .PP \&\fBmemcached_fetch()\fR is used to fetch an individual value from the server. \&\fBmemcached_mget()\fR must always be called before using this method. You must pass in a key and its length to fetch the object. You must supply three pointer variables which will give you the state of the returned object. A uint32_t pointer to contain whatever flags you stored with the value, a size_t pointer which will be filled with size of of the object, and a memcached_return_t pointer to hold any error. The object will be returned upon success and \s-1NULL\s0 will be returned on failure. \s-1MEMCACHD_END\s0 is returned by the *error value when all objects that have been found are returned. The final value upon \s-1MEMCACHED_END\s0 is null. Values returned by \&\fBmemcached_fetch()\fR musted be free'ed by the caller. \fBmemcached_fetch()\fR will be \s-1DEPRECATED\s0 in the near future, \fBmemcached_fetch_result()\fR should be used instead. .PP \&\fBmemcached_fetch_result()\fR is used to return a \fBmemcached_result_st\fR\|(3) structure from a memcached server. The result object is forward compatible with changes to the server. For more information please refer to the \fBmemcached_result_st\fR\|(3) help. This function will dynamically allocate a result structure for you if you do not pass one to the function. .PP \&\fBmemcached_fetch_execute()\fR is a callback function for result sets. Instead of returning the results to you for processing, it passes each of the result sets to the list of functions you provide. It passes to the function a memcached_st that can be cloned for use in the called function (it can not be used directly). It also passes a result set which does not need to be freed. Finally it passes a \*(L"context\*(R". This is just a pointer to a memory reference you supply the calling function. Currently only one value is being passed to each function call. In the future there will be an option to allow this to be an array. .PP \&\fBmemcached_mget_execute()\fR and \fBmemcached_mget_execute_by_key()\fR is similar to \fBmemcached_mget()\fR, but it may trigger the supplied callbacks with result sets while sending out the queries. If you try to perform a really large multiget with \fBmemcached_mget()\fR you may encounter a deadlock in the \s-1OS\s0 kernel (we fail to write data to the socket because the input buffer is full). \fBmemcached_mget_execute()\fR solves this problem by processing some of the results before continuing sending out requests. Please note that this function is only available in the binary protocol. .PP \&\fBmemcached_get_by_key()\fR and \fBmemcached_mget_by_key()\fR behave in a similar nature as \fBmemcached_get()\fR and \fBmemcached_mget()\fR. The difference is that they take a master key that is used for determining which server an object was stored if key partitioning was used for storage. .PP All of the above functions are not supported when the \f(CW\*(C`MEMCACHED_BEHAVIOR_USE_UDP\*(C'\fR has been set. Executing any of these functions with this behavior on will result in \&\f(CW\*(C`MEMCACHED_NOT_SUPPORTED\*(C'\fR being returned or, for those functions which do not return a \f(CW\*(C`memcached_return_t\*(C'\fR, the error function parameter will be set to \&\f(CW\*(C`MEMCACHED_NOT_SUPPORTED\*(C'\fR. .SH "RETURN" .IX Header "RETURN" All objects returned must be freed by the calling application. \&\fBmemcached_get()\fR and \fBmemcached_fetch()\fR will return \s-1NULL\s0 on error. You must look at the value of error to determine what the actual error was. .PP \&\s-1MEMCACHED_KEY_TOO_BIG\s0 is set to error whenever \fBmemcached_fetch()\fR was used and the key was set larger then \s-1MEMCACHED_MAX_KEY,\s0 which was the largest key allowed for the original memcached ascii server. .SH "HOME" .IX Header "HOME" To find out more information please check: .SH "AUTHOR" .IX Header "AUTHOR" Brian Aker, .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBmemcached\fR\|(1) \fBlibmemcached\fR\|(3) \fBmemcached_strerror\fR\|(3)