Merge of build trunk
[m6w6/libmemcached] / docs / man / memcached_callback_set.3
1 .TH "MEMCACHED_CALLBACK_SET" "3" "October 18, 2011" "1.01" "libmemcached"
2 .SH NAME
3 memcached_callback_set \- libmemcached Documentation
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 .sp
34 Get and set a callback
35 .SH SYNOPSIS
36 .sp
37 #include <libmemcached/memcached.h>
38 .INDENT 0.0
39 .TP
40 .B memcached_return_t memcached_callback_set (memcached_st *ptr, memcached_callback_t flag, const void *data);
41 .UNINDENT
42 .INDENT 0.0
43 .TP
44 .B void * memcached_callback_get (memcached_st *ptr, memcached_callback_t flag, memcached_return_t *error);
45 .UNINDENT
46 .sp
47 Compile and link with \-lmemcached
48 .SH DESCRIPTION
49 .sp
50 libmemcached(3) can have callbacks set key execution points. These either
51 provide function calls at points in the code, or return pointers to
52 structures for particular usages.
53 .sp
54 \fBmemcached_callback_get()\fP takes a callback flag and returns the
55 structure or function set by \fBmemcached_callback_set()\fP.
56 .sp
57 \fBmemcached_callback_set()\fP changes the function/structure assigned by a
58 callback flag. No connections are reset.
59 .sp
60 You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context
61 if required for any of the callbacks.
62 .INDENT 0.0
63 .TP
64 .B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
65 .UNINDENT
66 .sp
67 When \fBmemcached_delete()\fP is called this function will be excuted. At
68 the point of its execution all connections are closed.
69 .INDENT 0.0
70 .TP
71 .B MEMCACHED_CALLBACK_CLONE_FUNCTION
72 .UNINDENT
73 .sp
74 When \fBmemcached_delete()\fP is called this function will be excuted.
75 At the point of its execution all connections are closed.
76 .INDENT 0.0
77 .TP
78 .B MEMCACHED_CALLBACK_PREFIX_KEY
79 .
80 See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP
81 .UNINDENT
82 .INDENT 0.0
83 .TP
84 .B MEMCACHED_CALLBACK_NAMESPACE
85 .UNINDENT
86 .sp
87 You can set a value which will be used to create a domain for your keys.
88 The value specified here will be prefixed to each of your keys. The value can
89 not be greater then \fBMEMCACHED_PREFIX_KEY_MAX_SIZE \- 1\fP and will
90 reduce \fBMEMCACHED_MAX_KEY\fP by the value of your key.
91 .sp
92 The prefix key is only applied to the primary key, not the master key.
93 \fBMEMCACHED_FAILURE\fP will be returned if no key is set. In the case of
94 a key which is too long, \fBMEMCACHED_BAD_KEY_PROVIDED\fP will be returned.
95 .sp
96 If you set a value with the value being NULL then the prefix key is disabled.
97 .INDENT 0.0
98 .TP
99 .B MEMCACHED_CALLBACK_USER_DATA
100 .UNINDENT
101 .sp
102 This allows you to store a pointer to a specifc piece of data. This can be
103 retrieved from inside of \fBmemcached_fetch_execute()\fP. Cloning a
104 \fBmemcached_st\fP will copy the pointer to the clone.
105 .INDENT 0.0
106 .TP
107 .B MEMCACHED_CALLBACK_MALLOC_FUNCTION
108 .UNINDENT
109 .sp
110 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
111 .INDENT 0.0
112 .TP
113 .B MEMCACHED_CALLBACK_REALLOC_FUNCTION
114 .UNINDENT
115 .sp
116 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
117 .INDENT 0.0
118 .TP
119 .B MEMCACHED_CALLBACK_FREE_FUNCTION
120 .UNINDENT
121 .sp
122 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
123 .INDENT 0.0
124 .TP
125 .B MEMCACHED_CALLBACK_GET_FAILURE
126 .UNINDENT
127 .sp
128 This function implements the read through cache behavior. On failure of retrieval this callback will be called.
129 .sp
130 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.
131 .sp
132 You must clone the \fBmemcached_st\fP in order to
133 make use of it. The value will be stored only if you return
134 \fBMEMCACHED_SUCCESS\fP or \fBMEMCACHED_BUFFERED\fP. Returning
135 \fBMEMCACHED_BUFFERED\fP will cause the object to be buffered and not sent
136 immediatly (if this is the default behavior based on your connection setup
137 this will happen automatically).
138 .sp
139 The prototype for this is:
140 .INDENT 0.0
141 .TP
142 .B memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
143 .UNINDENT
144 .INDENT 0.0
145 .TP
146 .B MEMCACHED_CALLBACK_DELETE_TRIGGER
147 .UNINDENT
148 .sp
149 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.
150 .sp
151 The prototype for this is:
152 .INDENT 0.0
153 .TP
154 .B typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
155 .UNINDENT
156 .SH RETURN
157 .sp
158 \fBmemcached_callback_get()\fP return the function or structure that was
159 provided. Upon error, nothing is set, null is returned, and the
160 \fBmemcached_return_t\fP argument is set to \fBMEMCACHED_FAILURE\fP.
161 .sp
162 \fBmemcached_callback_set()\fP returns \fBMEMCACHED_SUCCESS\fP upon
163 successful setting, otherwise \fBMEMCACHED_FAILURE\fP on error.
164 .SH HOME
165 .sp
166 To find out more information please check:
167 \fI\%http://libmemcached.org/\fP
168 .SH AUTHOR
169 .sp
170 Brian Aker, <\fI\%brian@tangent.org\fP>
171 .SH SEE ALSO
172 .sp
173 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
174 .SH AUTHOR
175 Brian Aker
176 .SH COPYRIGHT
177 2011, Brian Aker DataDifferential, http://datadifferential.com/
178 .\" Generated by docutils manpage writer.
179 .\"
180 .