From 5355b183fb70fc83392e546566c6864da52c5784 Mon Sep 17 00:00:00 2001 From: Erick Hitter <ehitter@gmail.com> Date: Thu, 27 Feb 2014 13:12:32 -0800 Subject: [PATCH] Remove `wp_cache_increment()` and `wp_cache_decrement()` as they aren't part of Core's implementation. Users switching between cache backends shouldn't have to worry about function names changing. That's not how Core's object cache is designed. --- object-cache.php | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/object-cache.php b/object-cache.php index 6fe1600..2b12468 100644 --- a/object-cache.php +++ b/object-cache.php @@ -43,28 +43,12 @@ function wp_cache_close() { * * @return int|bool Returns item's new value on success or FALSE on failure. */ -function wp_cache_decrement( $key, $offset = 1, $group = '' ) { +function wp_cache_decr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->decrement( $key, $offset, $group ); } -/** - * Decrement a numeric item's value. - * - * Same as wp_cache_decrement. Original WordPress caching backends use wp_cache_decr. I - * want both spellings to work. - * - * @param string $key The key under which to store the value. - * @param int $offset The amount by which to decrement the item's value. - * @param string $group The group value appended to the $key. - * - * @return int|bool Returns item's new value on success or FALSE on failure. - */ -function wp_cache_decr( $key, $offset = 1, $group = '' ) { - return wp_cache_decrement( $key, $offset, $group ); -} - /** * Remove the item from the cache. * @@ -129,28 +113,12 @@ function wp_cache_get_stats() { * * @return int|bool Returns item's new value on success or FALSE on failure. */ -function wp_cache_increment( $key, $offset = 1, $group = '' ) { +function wp_cache_incr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->increment( $key, $offset, $group ); } -/** - * Increment a numeric item's value. - * - * This is the same as wp_cache_increment, but kept for back compatibility. The original - * WordPress caching backends use wp_cache_incr. I want both to work. - * - * @param string $key The key under which to store the value. - * @param int $offset The amount by which to increment the item's value. - * @param string $group The group value appended to the $key. - * - * @return int|bool Returns item's new value on success or FALSE on failure. - */ -function wp_cache_incr( $key, $offset = 1, $group = '' ) { - return wp_cache_increment( $key, $offset, $group ); -} - /** * Replaces a value in cache. * -- GitLab