~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to docs/memcached_callback.pod

  • Committer: patg@patg.net
  • Date: 2008-05-05 03:32:10 UTC
  • mfrom: (317.1.71)
  • Revision ID: patg@patg.net-20080505033210-yxv0us02t8lb44dy
Merge 477:75823cad36b7 with -r 476

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
memcached_callback_set() changes the function/structure assigned by a
33
33
callback flag. No connections are reset. 
34
34
 
 
35
You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for any 
 
36
of the callbacks
 
37
 
35
38
=over 4
36
39
 
37
40
=item MEMCACHED_CALLBACK_CLEANUP_FUNCTION
50
53
retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
51
54
will copy the pointer to the clone.
52
55
 
53
 
=item  MEMCACHED_CALLBACK_MALLOC_FUNCTION,
 
56
=item  MEMCACHED_CALLBACK_MALLOC_FUNCTION
54
57
 
55
58
This alllows yout to pass in a customized version of malloc that will be used instead of the builtin malloc(3) call.
56
59
The prototype for this is:
57
60
 
58
61
void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
59
62
 
60
 
You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for malloc.
61
 
 
62
 
=item  MEMCACHED_CALLBACK_REALLOC_FUNCTION,
 
63
=item  MEMCACHED_CALLBACK_REALLOC_FUNCTION
63
64
 
64
65
This alllows yout to pass in a customized version of realloc that will be used instead of the builtin realloc(3) call.
65
66
The prototype for this is:
66
67
 
67
68
void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
68
69
 
69
 
You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for realloc.
70
 
 
71
 
=item  MEMCACHED_CALLBACK_FREE_FUNCTION,
 
70
=item  MEMCACHED_CALLBACK_FREE_FUNCTION
72
71
 
73
72
This alllows yout to pass in a customized version of realloc that will be used instead of the builtin free(3) call.
74
73
The prototype for this is:
75
74
 
76
75
typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
77
76
 
78
 
You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for realloc.
 
77
=item  MEMCACHED_CALLBACK_GET_FAILURE
 
78
 
 
79
This function implements the read through cache behavior. On failure of retrieval this callback will be called. 
 
80
You are responsible for populating the result object provided. This result object will then be stored in the server and
 
81
returned to the calling process. You must clone the memcached_st in order to
 
82
make use of it. The value will be stored only if you return
 
83
MEMCACHED_SUCCESS or MEMCACHED_BUFFERED. Returning MEMCACHED_BUFFERED will
 
84
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).
 
85
 
 
86
The prototype for this is:
 
87
memcached_return (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
 
88
 
 
89
=item  MEMCACHED_CALLBACK_DELETE_TRIGGER
 
90
 
 
91
This function implements a trigger upon successful deletion of a key. The memcached_st structure will need to be cloned
 
92
in order to make use of it.
 
93
 
 
94
The prototype for this is:
 
95
typedef memcached_return (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
 
96
 
79
97
 
80
98
=back
81
99