Merge in updates to doc/build of memaslap.
[awesomized/libmemcached] / docs / man / memcached_callback_set.3
1 .TH "MEMCACHED_CALLBACK_SET" "3" "June 02, 2011" "0.47" "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, 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 memcached_callback_get() takes a callback flag and returns the structure or
55 function set by memcached_callback_set().
56 .sp
57 memcached_callback_set() changes the function/structure assigned by a
58 callback flag. No connections are reset.
59 .sp
60 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for any of the callbacks.
61 .INDENT 0.0
62 .TP
63 .B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
64 .UNINDENT
65 .sp
66 When memcached_delete() is called this function will be excuted. At the point of its execution all connections are closed.
67 .INDENT 0.0
68 .TP
69 .B MEMCACHED_CALLBACK_CLONE_FUNCTION
70 .UNINDENT
71 .sp
72 When memcached_delete() is called this function will be excuted. At the
73 point of its execution all connections are closed.
74 .INDENT 0.0
75 .TP
76 .B MEMCACHED_CALLBACK_PREFIX_KEY
77 .UNINDENT
78 .sp
79 You can set a value which will be used to create a domain for your keys.
80 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.
81 .sp
82 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.
83 .sp
84 If you set a value with the value being NULL then the prefix key is disabled.
85 .INDENT 0.0
86 .TP
87 .B MEMCACHED_CALLBACK_USER_DATA
88 .UNINDENT
89 .sp
90 This allows you to store a pointer to a specifc piece of data. This can be
91 retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
92 will copy the pointer to the clone.
93 .INDENT 0.0
94 .TP
95 .B MEMCACHED_CALLBACK_MALLOC_FUNCTION
96 .UNINDENT
97 .sp
98 DEPRECATED: use memcached_set_memory_allocators instead.
99 .INDENT 0.0
100 .TP
101 .B MEMCACHED_CALLBACK_REALLOC_FUNCTION
102 .UNINDENT
103 .sp
104 DEPRECATED: use memcached_set_memory_allocators instead.
105 .INDENT 0.0
106 .TP
107 .B MEMCACHED_CALLBACK_FREE_FUNCTION
108 .UNINDENT
109 .sp
110 DEPRECATED: use memcached_set_memory_allocators instead.
111 .INDENT 0.0
112 .TP
113 .B MEMCACHED_CALLBACK_GET_FAILURE
114 .UNINDENT
115 .sp
116 This function implements the read through cache behavior. On failure of retrieval this callback will be called.
117 .sp
118 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.
119 .sp
120 You must clone the memcached_st in order to
121 make use of it. The value will be stored only if you return
122 MEMCACHED_SUCCESS or MEMCACHED_BUFFERED. Returning MEMCACHED_BUFFERED will
123 cause the object to be buffered and not sent immediatly (if this is the default behavior based on your connection setup this will happen automatically).
124 .sp
125 The prototype for this is:
126 memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
127 .INDENT 0.0
128 .TP
129 .B MEMCACHED_CALLBACK_DELETE_TRIGGER
130 .UNINDENT
131 .sp
132 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.
133 .sp
134 The prototype for this is: typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
135 .SH RETURN
136 .sp
137 memcached_callback_get() return the function or structure that was provided.
138 Upon error, nothing is set, null is returned, and the memcached_return_t
139 argument is set to MEMCACHED_FAILURE.
140 .sp
141 memcached_callback_set() returns MEMCACHED_SUCCESS upon successful setting,
142 otherwise MEMCACHED_FAILURE on error.
143 .SH HOME
144 .sp
145 To find out more information please check:
146 \fI\%http://libmemcached.org/\fP
147 .SH AUTHOR
148 .sp
149 Brian Aker, <\fI\%brian@tangent.org\fP>
150 .SH SEE ALSO
151 .sp
152 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
153 .SH AUTHOR
154 Brian Aker
155 .SH COPYRIGHT
156 2011, Brian Aker DataDifferential, http://datadifferential.com/
157 .\" Generated by docutils manpage writer.
158 .\"
159 .