.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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_callback 3pm" .TH Memcached::libmemcached::memcached_callback 3pm 2024-03-07 "perl v5.38.2" "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_callback_get, memcached_callback_set \- Get and set a callback .SH LIBRARY .IX Header "LIBRARY" C Client Library for memcached (libmemcached, \-lmemcached) .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& memcached_return_t \& memcached_callback_set (memcached_st *ptr, \& memcached_callback_t flag, \& void *data); \& \& void * \& memcached_callback_get (memcached_st *ptr, \& memcached_callback_t flag, \& memcached_return_t *error); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBlibmemcached\fR\|(3) can have callbacks set key execution points. These either provide function calls at points in the code, or return pointers to structures for particular usages. .PP \&\fBmemcached_callback_get()\fR takes a callback flag and returns the structure or function set by \fBmemcached_callback_set()\fR. .PP \&\fBmemcached_callback_set()\fR changes the function/structure assigned by a callback flag. No connections are reset. .PP You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for any of the callbacks .IP MEMCACHED_CALLBACK_CLEANUP_FUNCTION 4 .IX Item "MEMCACHED_CALLBACK_CLEANUP_FUNCTION" When \fBmemcached_delete()\fR is called this function will be executed. At the point of its execution all connections have been closed. .IP MEMCACHED_CALLBACK_CLONE_FUNCTION 4 .IX Item "MEMCACHED_CALLBACK_CLONE_FUNCTION" When \fBmemcached_delete()\fR is called this function will be executed. At the point of its execution all connections have been closed. .IP MEMCACHED_CALLBACK_PREFIX_KEY 4 .IX Item "MEMCACHED_CALLBACK_PREFIX_KEY" You can set a value which will be used to create a domain for your keys. The value specified here will be prefixed to each of your keys. The value can not be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE \- 1 and will reduce MEMCACHED_MAX_KEY by the value of your key. The prefix key is only applied to the primary key, not the master key. MEMCACHED_FAILURE will be returned if no key is set. In the case of a key which is too long MEMCACHED_BAD_KEY_PROVIDED will be returned. .IP MEMCACHED_CALLBACK_USER_DATA 4 .IX Item "MEMCACHED_CALLBACK_USER_DATA" This allows you to store a pointer to a specifc piece of data. This can be retrieved from inside of \fBmemcached_fetch_execute()\fR. Cloning a memcached_st will copy the pointer to the clone. .IP MEMCACHED_CALLBACK_MALLOC_FUNCTION 4 .IX Item "MEMCACHED_CALLBACK_MALLOC_FUNCTION" DEPRECATED: use memcached_set_memory_allocators instead. .IP MEMCACHED_CALLBACK_REALLOC_FUNCTION 4 .IX Item "MEMCACHED_CALLBACK_REALLOC_FUNCTION" DEPRECATED: use memcached_set_memory_allocators instead. .IP MEMCACHED_CALLBACK_FREE_FUNCTION 4 .IX Item "MEMCACHED_CALLBACK_FREE_FUNCTION" DEPRECATED: use memcached_set_memory_allocators instead. .IP MEMCACHED_CALLBACK_GET_FAILURE 4 .IX Item "MEMCACHED_CALLBACK_GET_FAILURE" This function implements the read through cache behavior. On failure of retrieval this callback will be called. You are responsible for populating the result object provided. This result object will then be stored in the server and returned to the calling process. You must clone the memcached_st in order to make use of it. The value will be stored only if you return MEMCACHED_SUCCESS or MEMCACHED_BUFFERED. Returning MEMCACHED_BUFFERED will cause the object to be buffered and not sent immediately (if this is the default behavior based on your connection setup this will happen automatically). .Sp The prototype for this is: memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result); .IP MEMCACHED_CALLBACK_DELETE_TRIGGER 4 .IX Item "MEMCACHED_CALLBACK_DELETE_TRIGGER" This function implements a trigger upon successful deletion of a key. The memcached_st structure will need to be cloned in order to make use of it. .Sp The prototype for this is: typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length); .SH RETURN .IX Header "RETURN" \&\fBmemcached_callback_get()\fR return the function or structure that was provided. Upon error, nothing is set, null is returned, and the memcached_return_t argument is set to MEMCACHED_FAILURE. .PP \&\fBmemcached_callback_set()\fR returns MEMCACHED_SUCCESS upon successful setting, otherwise MEMCACHED_FAILURE on error. .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)