original_string: protected function pushCache(&$entity, $className) {
      if (!isset($entity->guid)) {
        return;
      }
      // Increment the entity access count.
      if (!isset($this->entityCount[$entity->guid])) {
        $this->entityCount[$entity->guid] = 0;
      }
      $this->entityCount[$entity->guid]++;
      // Check the threshold.
      if ($this->entityCount[$entity->guid] < $this->config['cache_threshold']) {
        return;
      }
      // Cache the entity.
      if ((array) $this->entityCache[$entity->guid] ===
          $this->entityCache[$entity->guid]) {
        $this->entityCache[$entity->guid][$className] = clone $entity;
      } else {
        while ($this->config['cache_limit']
            && count($this->entityCache) >= $this->config['cache_limit']) {
          // Find which entity has been accessed the least.
          asort($this->entityCount);
          foreach ($this->entityCount as $key => $val) {
            if (isset($this->entityCache[$key])) {
              break;
            }
          }
          // Remove it.
          if (isset($this->entityCache[$key])) {
            unset($this->entityCache[$key]);
          }
        }
        $this->entityCache[$entity->guid] = [$className => (clone $entity)];
      }
      $this->entityCache[$entity->guid][$className]->clearCache();
    }
code: protected function pushCache(&$entity, $className) {
      if (!isset($entity->guid)) {
        return;
      }
      // Increment the entity access count.
      if (!isset($this->entityCount[$entity->guid])) {
        $this->entityCount[$entity->guid] = 0;
      }
      $this->entityCount[$entity->guid]++;
      // Check the threshold.
      if ($this->entityCount[$entity->guid] < $this->config['cache_threshold']) {
        return;
      }
      // Cache the entity.
      if ((array) $this->entityCache[$entity->guid] ===
          $this->entityCache[$entity->guid]) {
        $this->entityCache[$entity->guid][$className] = clone $entity;
      } else {
        while ($this->config['cache_limit']
            && count($this->entityCache) >= $this->config['cache_limit']) {
          // Find which entity has been accessed the least.
          asort($this->entityCount);
          foreach ($this->entityCount as $key => $val) {
            if (isset($this->entityCache[$key])) {
              break;
            }
          }
          // Remove it.
          if (isset($this->entityCache[$key])) {
            unset($this->entityCache[$key]);
          }
        }
        $this->entityCache[$entity->guid] = [$className => (clone $entity)];
      }
      $this->entityCache[$entity->guid][$className]->clearCache();
    }
code_tokens: protected function pushCache ( & $ entity , $ className ) { if ( ! isset ( $ entity -> guid ) ) { return ; } // Increment the entity access count. if ( ! isset ( $ this -> entityCount [ $ entity -> guid ] ) ) { $ this -> entityCount [ $ entity -> guid ] = 0 ; } $ this -> entityCount [ $ entity -> guid ] ++ ; // Check the threshold. if ( $ this -> entityCount [ $ entity -> guid ] < $ this -> config [ 'cache_threshold' ] ) { return ; } // Cache the entity. if ( ( array ) $ this -> entityCache [ $ entity -> guid ] === $ this -> entityCache [ $ entity -> guid ] ) { $ this -> entityCache [ $ entity -> guid ] [ $ className ] = clone $ entity ; } else { while ( $ this -> config [ 'cache_limit' ] && count ( $ this -> entityCache ) >= $ this -> config [ 'cache_limit' ] ) { // Find which entity has been accessed the least. asort ( $ this -> entityCount ) ; foreach ( $ this -> entityCount as $ key => $ val ) { if ( isset ( $ this -> entityCache [ $ key ] ) ) { break ; } } // Remove it. if ( isset ( $ this -> entityCache [ $ key ] ) ) { unset ( $ this -> entityCache [ $ key ] ) ; } } $ this -> entityCache [ $ entity -> guid ] = [ $ className => ( clone $ entity ) ] ; } $ this -> entityCache [ $ entity -> guid ] [ $ className ] -> clearCache ( ) ; }
docstring: Push an entity onto the cache.
  
  @param Entity &$entity The entity to push onto the cache.
  @param string $className The class of the entity.
  @access protected
docstring_tokens: Push an entity onto the cache .