Make WordPress Core

Changeset 21285


Ignore:
Timestamp:
07/20/2012 04:21:42 AM (13 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r20091 r21285  
    532532    /**
    533533     * Utility function to determine whether a key exists in the cache.
    534      * @access private
    535      */
    536     protected function _exists($key, $group) {
    537         return isset( $this->cache[$group] ) && is_array( $this->cache[$group] ) && array_key_exists( $key, $this->cache[$group] );
     534     *
     535     * @since 3.4.0
     536     *
     537     * @access protected
     538     */
     539    protected function _exists( $key, $group ) {
     540        return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) );
    538541    }
    539542
Note: See TracChangeset for help on using the changeset viewer.