Permalink
Browse files

Simplify the touch code

Try to separate the PHP logic and the libcouchbase logic.
I've separated the multi-get and single get operation because
they only share a small subset of logic.. (and that piece
could in theory be refactored to a common part if we want).

Change-Id: I4b0c89e110aa4d96f9dc7cba24bc89838356c1d3
Reviewed-on: http://review.couchbase.org/23201
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information...
1 parent cf70968 commit b91a9b30c743083fd94d48f14ed867ab5419fc27 @trondn trondn committed with ingenthr Dec 11, 2012
Showing with 207 additions and 174 deletions.
  1. +4 −4 apidecl.c
  2. +4 −1 apidecl.h
  3. +0 −1 couchbase.c
  4. +0 −3 php_couchbase.h
  5. +199 −165 touch.c
View
@@ -760,15 +760,15 @@ PHP_METHOD(couchbase, unlock)
*/
PHP_METHOD(couchbase, touch)
{
- php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 1);
+ php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto Couchbase::touchMulti(array $keys, int $expiry)
*/
PHP_METHOD(couchbase, touchMulti)
{
- php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, 1);
+ php_couchbase_touch_multi_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
@@ -1086,15 +1086,15 @@ PHP_FUNCTION(couchbase_unlock)
*/
PHP_FUNCTION(couchbase_touch)
{
- php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 0);
+ php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto couchbase_touch_multi(resource $couchbase, array $keys, int $expiry)
*/
PHP_FUNCTION(couchbase_touch_multi)
{
- php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, 0);
+ php_couchbase_touch__multi_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
View
@@ -52,7 +52,10 @@ PHP_COUCHBASE_LOCAL
void php_couchbase_unlock_impl(INTERNAL_FUNCTION_PARAMETERS, int oo);
PHP_COUCHBASE_LOCAL
-void php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAMETERS, int multi, int oo);
+void php_couchbase_touch_impl(INTERNAL_FUNCTION_PARAMETERS, int oo);
+
+PHP_COUCHBASE_LOCAL
+void php_couchbase_touch_multi_impl(INTERNAL_FUNCTION_PARAMETERS, int oo);
PHP_COUCHBASE_LOCAL
void php_couchbase_fetch_impl(INTERNAL_FUNCTION_PARAMETERS, int multi, int oo);
View
@@ -89,7 +89,6 @@ void php_couchbase_setup_callbacks(lcb_t handle)
php_couchbase_callbacks_get_init(handle);
php_couchbase_callbacks_store_init(handle);
php_couchbase_callbacks_remove_init(handle);
- php_couchbase_callbacks_touch_init(handle);
php_couchbase_callbacks_observe_init(handle);
php_couchbase_callbacks_view_init(handle);
php_couchbase_callbacks_stat_init(handle);
View
@@ -387,9 +387,6 @@ PHP_COUCHBASE_LOCAL
void php_couchbase_callbacks_remove_init(lcb_t handle);
PHP_COUCHBASE_LOCAL
-void php_couchbase_callbacks_touch_init(lcb_t handle);
-
-PHP_COUCHBASE_LOCAL
void php_couchbase_callbacks_view_init(lcb_t handle);
PHP_COUCHBASE_LOCAL
Oops, something went wrong.

0 comments on commit b91a9b3

Please sign in to comment.