1
.TH "MEMCACHED_CALLBACK_SET" "3" "September 16, 2012" "1.0.10" "libmemcached"
3
memcached_callback_set \- libmemcached Documentation
5
.nr rst2man-indent-level 0
9
level \\n[rst2man-indent-level]
10
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17
.\" .rstReportMargin pre:
19
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20
. nr rst2man-indent-level +1
21
.\" .rstReportMargin post:
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
31
.\" Man page generated from reStructeredText.
34
Get and set a callback
37
#include <libmemcached/memcached.h>
40
.B memcached_callback_t
44
.B memcached_return_t memcached_callback_set(memcached_st\fI\ *ptr\fP, \fI\%memcached_callback_t\fP\fI\ flag\fP, const void\fI\ *data\fP)
48
.B void * memcached_callback_get(memcached_st\fI\ *ptr\fP, \fI\%memcached_callback_t\fP\fI\ flag\fP, memcached_return_t\fI\ *error\fP)
51
Compile and link with \-lmemcached
54
libmemcached(3) can have callbacks set key execution points. These either
55
provide function calls at points in the code, or return pointers to
56
structures for particular usages.
58
\fI\%memcached_callback_get()\fP takes a callback flag and returns the
59
structure or function set by \fI\%memcached_callback_set()\fP.
61
\fI\%memcached_callback_set()\fP changes the function/structure assigned by a
62
callback flag. No connections are reset.
64
You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context
65
if required for any of the callbacks.
68
.B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
71
When \fBmemcached_delete()\fP is called this function will be excuted. At
72
the point of its execution all connections are closed.
75
.B MEMCACHED_CALLBACK_CLONE_FUNCTION
78
When \fBmemcached_delete()\fP is called this function will be excuted.
79
At the point of its execution all connections are closed.
82
.B MEMCACHED_CALLBACK_PREFIX_KEY
83
See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP
87
.B MEMCACHED_CALLBACK_NAMESPACE
90
You can set a value which will be used to create a domain for your keys.
91
The value specified here will be prefixed to each of your keys. The value can
92
not be greater then \fBMEMCACHED_PREFIX_KEY_MAX_SIZE\fP \- 1 and will
93
reduce \fBMEMCACHED_MAX_KEY\fP by the value of your key.
95
The prefix key is only applied to the primary key, not the master key.
96
\fBMEMCACHED_FAILURE\fP will be returned if no key is set. In the case of
97
a key which is too long, \fBMEMCACHED_BAD_KEY_PROVIDED\fP will be returned.
99
If you set a value with the value being NULL then the prefix key is disabled.
102
.B MEMCACHED_CALLBACK_USER_DATA
105
This allows you to store a pointer to a specifc piece of data. This can be
106
retrieved from inside of \fBmemcached_fetch_execute()\fP. Cloning a
107
\fBmemcached_st\fP will copy the pointer to the clone.
110
.B MEMCACHED_CALLBACK_MALLOC_FUNCTION
113
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
116
.B MEMCACHED_CALLBACK_REALLOC_FUNCTION
119
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
122
.B MEMCACHED_CALLBACK_FREE_FUNCTION
125
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
128
.B MEMCACHED_CALLBACK_GET_FAILURE
131
This function implements the read through cache behavior. On failure of retrieval this callback will be called.
133
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.
135
You must clone the \fBmemcached_st\fP in order to
136
make use of it. The value will be stored only if you return
137
\fBMEMCACHED_SUCCESS\fP or \fBMEMCACHED_BUFFERED\fP. Returning
138
\fBMEMCACHED_BUFFERED\fP will cause the object to be buffered and not sent
139
immediatly (if this is the default behavior based on your connection setup
140
this will happen automatically).
142
The prototype for this is:
145
.B memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
149
.B MEMCACHED_CALLBACK_DELETE_TRIGGER
152
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.
154
The prototype for this is:
157
.B typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
161
\fI\%memcached_callback_get()\fP return the function or structure that was
162
provided. Upon error, nothing is set, null is returned, and the
163
\fBmemcached_return_t\fP argument is set to \fBMEMCACHED_FAILURE\fP.
165
\fI\%memcached_callback_set()\fP returns \fBMEMCACHED_SUCCESS\fP upon
166
successful setting, otherwise \fBMEMCACHED_FAILURE\fP on error.
169
To find out more information please check:
170
\fI\%http://libmemcached.org/\fP
173
Brian Aker, <\fI\%brian@tangent.org\fP>
176
\fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
180
2011-2012, Brian Aker DataDifferential, http://datadifferential.com/
181
.\" Generated by docutils manpage writer.