1..::docs::memcached_callback(3) libmemcached ..::docs::memcached_callback(3)
2
3
4
6 memcached_callback_get, memcached_callback_set - Get and set a callback
7
9 C Client Library for memcached (libmemcached, -lmemcached)
10
12 #include <memcached.h>
13
14 memcached_return
15 memcached_callback_set (memcached_st *ptr,
16 memcached_callback flag,
17 void *data);
18
19 void *
20 memcached_callback_get (memcached_st *ptr,
21 memcached_callback flag,
22 memcached_return *error);
23
25 libmemcached(3) can have callbacks set key execution points. These
26 either provide function calls at points in the code, or return pointers
27 to structures for particular usages.
28
29 memcached_callback_get() takes a callback flag and returns the
30 structure or function set by memcached_callback_set().
31
32 memcached_callback_set() changes the function/structure assigned by a
33 callback flag. No connections are reset.
34
35 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if
36 required for any of the callbacks
37
38 MEMCACHED_CALLBACK_CLEANUP_FUNCTION
39 When memcached_delete() is called this function will be excuted. At
40 the point of its execution all connections have been closed.
41
42 MEMCACHED_CALLBACK_CLONE_FUNCTION
43 When memcached_delete() is called this function will be excuted. At
44 the point of its execution all connections have been closed.
45
46 MEMCACHED_CALLBACK_PREFIX_KEY
47 You can set a value which will be used to create a domain for your
48 keys. The value specified here will be prefixed to each of your
49 keys. The value can not be greater then
50 MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 and will reduce MEMCACHED_MAX_KEY
51 by the value of your key. The prefix key is only applied to the
52 primary key, not the master key. MEMCACHED_FAILURE will be returned
53 if no key is set. In the case of a key which is too long
54 MEMCACHED_BAD_KEY_PROVIDED will be returned.
55
56 MEMCACHED_CALLBACK_USER_DATA
57 This allows you to store a pointer to a specifc piece of data. This
58 can be retrieved from inside of memcached_fetch_execute(). Cloning
59 a memcached_st will copy the pointer to the clone.
60
61 MEMCACHED_CALLBACK_MALLOC_FUNCTION
62 DEPRECATED: use memcached_set_memory_allocators instead.
63
64 MEMCACHED_CALLBACK_REALLOC_FUNCTION
65 DEPRECATED: use memcached_set_memory_allocators instead.
66
67 MEMCACHED_CALLBACK_FREE_FUNCTION
68 DEPRECATED: use memcached_set_memory_allocators instead.
69
70 MEMCACHED_CALLBACK_GET_FAILURE
71 This function implements the read through cache behavior. On
72 failure of retrieval this callback will be called. You are
73 responsible for populating the result object provided. This result
74 object will then be stored in the server and returned to the
75 calling process. You must clone the memcached_st in order to make
76 use of it. The value will be stored only if you return
77 MEMCACHED_SUCCESS or MEMCACHED_BUFFERED. Returning
78 MEMCACHED_BUFFERED will cause the object to be buffered and not
79 sent immediatly (if this is the default behavior based on your
80 connection setup this will happen automatically).
81
82 The prototype for this is: memcached_return
83 (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t
84 key_length, memcached_result_st *result);
85
86 MEMCACHED_CALLBACK_DELETE_TRIGGER
87 This function implements a trigger upon successful deletion of a
88 key. The memcached_st structure will need to be cloned in order to
89 make use of it.
90
91 The prototype for this is: typedef memcached_return
92 (*memcached_trigger_delete_key)(memcached_st *ptr, char *key,
93 size_t key_length);
94
96 memcached_callback_get() return the function or structure that was
97 provided. Upon error, nothing is set, null is returned, and the
98 memcached_return argument is set to MEMCACHED_FAILURE.
99
100 memcached_callback_set() returns MEMCACHED_SUCCESS upon successful
101 setting, otherwise MEMCACHED_FAILURE on error.
102
104 To find out more information please check:
105 <http://tangent.org/552/libmemcached.html>
106
108 Brian Aker, <brian@tangent.org>
109
111 memcached(1) libmemcached(3) memcached_strerror(3)
112
113
114
115 2009-06-14 ..::docs::memcached_callback(3)