* Read through cached support.
* Fixed for cas by key operation.
* Fix for memcached_server_st list structures to have correct count.
+ * Added callback MEMCACHED_CALLBACK_DELETE_TRIGGER
0.18 Sun Mar 16 21:57:55 PDT 2008
retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
will copy the pointer to the clone.
-=item MEMCACHED_CALLBACK_MALLOC_FUNCTION,
+=item MEMCACHED_CALLBACK_MALLOC_FUNCTION
This alllows yout to pass in a customized version of malloc that will be used instead of the builtin malloc(3) call.
The prototype for this is:
void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
-=item MEMCACHED_CALLBACK_REALLOC_FUNCTION,
+=item MEMCACHED_CALLBACK_REALLOC_FUNCTION
This alllows yout to pass in a customized version of realloc that will be used instead of the builtin realloc(3) call.
The prototype for this is:
void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
-=item MEMCACHED_CALLBACK_FREE_FUNCTION,
+=item MEMCACHED_CALLBACK_FREE_FUNCTION
This alllows yout to pass in a customized version of realloc that will be used instead of the builtin free(3) call.
The prototype for this is:
typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
-=item MEMCACHED_CALLBACK_GET_FAILURE,
+=item MEMCACHED_CALLBACK_GET_FAILURE
This function implements the read through cache behavior. On failure of retrieval this callback will be called.
You are responsible for populating the result object provided. This result object will then be stored in the server and
The prototype for this is:
memcached_return (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
+=item MEMCACHED_CALLBACK_DELETE_TRIGGER
+
+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.
+
+The prototype for this is:
+typedef memcached_return (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
+
+
=back
=head1 RETURN
new_clone->call_malloc= ptr->call_malloc;
new_clone->call_realloc= ptr->call_realloc;
new_clone->get_key_failure= ptr->get_key_failure;
+ new_clone->delete_trigger= ptr->delete_trigger;
if (ptr->on_clone)
ptr->on_clone(ptr, new_clone);
memcached_malloc_function call_malloc;
memcached_realloc_function call_realloc;
memcached_trigger_key get_key_failure;
+ memcached_trigger_delete_key delete_trigger;
#ifdef NOT_USED /* Future Use */
uint8_t replicas;
memcached_return warning;
ptr->get_key_failure= func;
break;
}
+ case MEMCACHED_CALLBACK_DELETE_TRIGGER:
+ {
+ memcached_trigger_delete_key func= (memcached_trigger_delete_key)data;
+ ptr->delete_trigger= func;
+ break;
+ }
default:
return MEMCACHED_FAILURE;
}
*error= ptr->get_key_failure ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
return (void *)ptr->get_key_failure;
}
+ case MEMCACHED_CALLBACK_DELETE_TRIGGER:
+ {
+ *error= ptr->delete_trigger ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
+ return (void *)ptr->delete_trigger;
+ }
default:
WATCHPOINT_ASSERT(0);
*error= MEMCACHED_FAILURE;
MEMCACHED_CALLBACK_REALLOC_FUNCTION,
MEMCACHED_CALLBACK_FREE_FUNCTION,
MEMCACHED_CALLBACK_GET_FAILURE,
+ MEMCACHED_CALLBACK_DELETE_TRIGGER,
} memcached_callback;
typedef enum {
rc= MEMCACHED_SUCCESS;
}
+ if (rc == MEMCACHED_SUCCESS && ptr->delete_trigger)
+ ptr->delete_trigger(ptr, key, key_length);
+
error:
LIBMEMCACHED_MEMCACHED_DELETE_END();
return rc;
typedef memcached_return (*memcached_trigger_key)(memcached_st *ptr,
char *key, size_t key_length,
memcached_result_st *result);
+typedef memcached_return (*memcached_trigger_delete_key)(memcached_st *ptr,
+ char *key, size_t key_length);
#ifdef __cplusplus
}
return 0;
}
+memcached_return delete_trigger(memcached_st *ptr, char *key, size_t key_length)
+{
+ assert(key);
+
+ return MEMCACHED_SUCCESS;
+}
+
+uint8_t delete_through(memcached_st *memc)
+{
+ memcached_trigger_delete_key callback;
+ memcached_return rc;
+
+ callback= delete_trigger;
+
+ rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_DELETE_TRIGGER, callback);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ return 0;
+}
+
uint8_t get_test(memcached_st *memc)
{
memcached_return rc;
{"bad_key", 1, bad_key_test },
{"memcached_server_cursor", 1, memcached_server_cursor_test },
{"read_through", 1, read_through },
+ {"delete_through", 1, delete_through },
{0, 0, 0}
};