.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MEMCACHED_CALLBACK_GET" "3" "Mar 11, 2024" "1.1" "libmemcached-awesome" .SH NAME memcached_callback_get \- libmemcached Documentation .SH SYNOPSIS .INDENT 0.0 .TP .B #include Compile and link with \-lmemcached .UNINDENT .INDENT 0.0 .TP .B \fI\%memcached_return_t\fP memcached_callback_set(\fI\%memcached_st\fP *ptr, \fI\%memcached_callback_t\fP flag, const void *data) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBptr\fP \-\- pointer to initialized \fI\%memcached_st\fP struct .IP \(bu 2 \fBflag\fP \-\- \fI\%memcached_callback_t\fP flag to set .IP \(bu 2 \fBdata\fP \-\- data corresponding to \fI\%flag\fP .UNINDENT .TP .B Returns \fI\%memcached_return_t\fP indicating success .UNINDENT .UNINDENT .INDENT 0.0 .TP .B void *memcached_callback_get(\fI\%memcached_st\fP *ptr, \fI\%memcached_callback_t\fP flag, \fI\%memcached_return_t\fP *error) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBptr\fP \-\- pointer to initialized \fI\%memcached_st\fP struct .IP \(bu 2 \fBflag\fP \-\- \fI\%memcached_callback_t\fP flag to query .IP \(bu 2 \fBerror\fP \-\- pointer to \fI\%memcached_return_t\fP indicating success .UNINDENT .TP .B Returns the \fBdata\fP previously set .UNINDENT .UNINDENT .INDENT 0.0 .TP .B typedef enum \fI\%memcached_callback_t\fP memcached_callback_t .UNINDENT .INDENT 0.0 .TP .B enum memcached_callback_t .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_CLEANUP_FUNCTION When \fI\%memcached_free()\fP or \fBmemcached_reset\fP is called this function will be executed. At the point of its execution all connections are closed. .sp Its signature is: .INDENT 7.0 .TP .B typedef \fI\%memcached_return_t\fP (*memcached_cleanup_fn)(const \fI\%memcached_st\fP *ptr) .UNINDENT .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_CLONE_FUNCTION When \fI\%memcached_clone()\fP is called this function will be executed. .sp Its signature is: .INDENT 7.0 .TP .B typedef \fI\%memcached_return_t\fP (*memcached_clone_fn)(\fI\%memcached_st\fP *destination, const \fI\%memcached_st\fP *source) .UNINDENT .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_PREFIX_KEY See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP\&. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_NAMESPACE 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 \fI\%MEMCACHED_MAX_NAMESPACE\fP \- 1 and will reduce \fI\%MEMCACHED_MAX_KEY\fP by the value of your key. .sp The prefix key is only applied to the primary key, not the master key. \fI\%MEMCACHED_FAILURE\fP will be returned if no key is set. In the case of a key which is too long, \fI\%MEMCACHED_BAD_KEY_PROVIDED\fP will be returned. .sp If you set a value with the value being NULL then the prefix key is disabled. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_USER_DATA This allows you to store a pointer to a specific piece of data. This can be retrieved from inside of \fI\%memcached_fetch_execute()\fP\&. Cloning a \fI\%memcached_st\fP will copy the pointer to the clone. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_MALLOC_FUNCTION Deprecated since version <0.32: Use \fI\%memcached_set_memory_allocators()\fP instead. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_REALLOC_FUNCTION Deprecated since version <0.32: Use \fI\%memcached_set_memory_allocators()\fP instead. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_FREE_FUNCTION Deprecated since version <0.32: Use \fI\%memcached_set_memory_allocators()\fP instead. .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_GET_FAILURE This function implements the read through cache behavior. On failure of retrieval this callback will be called. .sp 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. .sp You must clone the \fI\%memcached_st\fP in order to make use of it. The value will be stored only if you return \fI\%MEMCACHED_SUCCESS\fP or \fI\%MEMCACHED_BUFFERED\fP\&. Returning \fI\%MEMCACHED_BUFFERED\fP 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: .INDENT 7.0 .TP .B typedef \fI\%memcached_return_t\fP (*memcached_trigger_key)(\fI\%memcached_st\fP *ptr, char *key, size_t key_length, \fI\%memcached_result_st\fP *result) .UNINDENT .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_CALLBACK_DELETE_TRIGGER This function implements a trigger upon successful deletion of a key. The \fI\%memcached_st\fP structure will need to be cloned in order to make use of it. .sp The prototype for this is: .INDENT 7.0 .TP .B typedef \fI\%memcached_return_t\fP (*memcached_trigger_delete_key)(\fI\%memcached_st\fP *ptr, char *key, size_t key_length) .UNINDENT .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBlibmemcached\fP 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. .sp \fI\%memcached_callback_get()\fP takes a callback flag and returns the structure or function set by \fI\%memcached_callback_set()\fP\&. .sp \fI\%memcached_callback_set()\fP changes the function/structure assigned by a callback flag. No connections are reset. .sp You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context if required for any of the callbacks. .SH RETURN VALUE .sp \fI\%memcached_callback_get()\fP returns the function or structure that was provided. Upon error, nothing is set, NULL is returned, and the \fI\%memcached_return_t\fP argument is set to \fI\%MEMCACHED_FAILURE\fP\&. .sp \fI\%memcached_callback_set()\fP returns \fI\%MEMCACHED_SUCCESS\fP upon successful setting, otherwise \fI\%MEMCACHED_FAILURE\fP on error. .SH SEE ALSO .sp \fBmemcached(1)\fP \fBlibmemcached(3)\fP \fBmemcached_strerror(3)\fP .\" Generated by docutils manpage writer. .