From 5b2c145a4deb04ecff4196ba482be4e978c780cd Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 20 Jul 2012 04:21:42 +0000 Subject: [PATCH] Improve the performance of WP_Object_Cache's _exists() method. Results showed a performance improvement on one admin screen of 90ms (~2%). fixes #21320. see #20004. git-svn-id: http://core.svn.wordpress.org/trunk@21285 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/cache.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/cache.php b/wp-includes/cache.php index bb61249cfb..415566902a 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -531,10 +531,13 @@ class WP_Object_Cache { /** * Utility function to determine whether a key exists in the cache. - * @access private + * + * @since 3.4.0 + * + * @access protected */ - protected function _exists($key, $group) { - return isset( $this->cache[$group] ) && is_array( $this->cache[$group] ) && array_key_exists( $key, $this->cache[$group] ); + protected function _exists( $key, $group ) { + return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) ); } /**