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: https://develop.svn.wordpress.org/trunk@21285 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-07-20 04:21:42 +00:00
parent d43f1b9948
commit 237b7f6dbe
1 changed files with 6 additions and 3 deletions

View File

@ -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 ] ) );
}
/**