Development

Changeset 7724

You must first sign up to be able to contribute.

Changeset 7724

Show
Ignore:
Timestamp:
03/03/08 14:35:23 (6 months ago)
Author:
fabien
Message:

changed sfWebResponse::*PartialCache?() signatures, fixed phpdoc (WIP)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfCompat10Plugin/lib/helper/PartialHelper.php

    r7717 r7724  
    114114  { 
    115115    $cacheManager->registerConfiguration($moduleName); 
    116     if ($retval = $cacheManager->getPartialCache($moduleName, $actionName, $vars)) 
     116    if ($retval = $cacheManager->getPartialCache($moduleName, $actionName, $cacheManager->computeCacheKey($vars))) 
    117117    { 
    118118      return $retval; 
     
    177177    if ($cacheManager) 
    178178    { 
    179       $retval = $cacheManager->setPartialCache($moduleName, $actionName, $vars, $retval); 
     179      $retval = $cacheManager->setPartialCache($moduleName, $actionName, $cacheManager->computeCacheKey($vars), $retval); 
    180180    } 
    181181 
     
    242242    $cacheManager->registerConfiguration($moduleName); 
    243243    $uri = '@sf_cache_partial?module='.$moduleName.'&action='.$actionName.'&sf_cache_key='.(isset($vars['sf_cache_key']) ? $vars['sf_cache_key'] : md5(serialize($vars))); 
    244     if ($retval = $cacheManager->getPartialCache($moduleName, $actionName, $vars)) 
     244    if ($retval = $cacheManager->getPartialCache($moduleName, $actionName, $cacheManager->computeCacheKey($vars))) 
    245245    { 
    246246      return $retval; 
     
    255255  if ($cacheManager) 
    256256  { 
    257     $retval = $cacheManager->setPartialCache($moduleName, $actionName, $vars, $retval); 
     257    $retval = $cacheManager->setPartialCache($moduleName, $actionName, $cacheManager->computeCacheKey($vars), $retval); 
    258258  } 
    259259 
  • branches/1.1/lib/view/sfViewCacheManager.class.php

    r7723 r7724  
    520520  } 
    521521 
    522   public function computeCacheKey($parameters) 
     522  /** 
     523   * Computes the cache key based on the passed parameters. 
     524   * 
     525   * @param array An array of parameters 
     526   */ 
     527  public function computeCacheKey(array $parameters) 
    523528  { 
    524529    return isset($parameters['sf_cache_key']) ? $parameters['sf_cache_key'] : md5(serialize($parameters)); 
    525530  } 
    526531 
    527   public function getPartialUri($module, $action, $parameters) 
    528   { 
    529     return sprintf('@sf_cache_partial?module=%s&action=%s&sf_cache_key=%s', $module, $action, $this->computeCacheKey($parameters)); 
     532  /** 
     533   * Computes a partial internal URI. 
     534   * 
     535   * @param  string The module name 
     536   * @param  string The action name 
     537   * @param  string The cache key 
     538   * 
     539   * @return string The internal URI 
     540   */ 
     541  public function getPartialUri($module, $action, $cacheKey) 
     542  { 
     543    return sprintf('@sf_cache_partial?module=%s&action=%s&sf_cache_key=%s', $module, $action, $cacheKey); 
    530544  } 
    531545 
     
    533547   * Returns whether a partial template is in the cache. 
    534548   * 
    535    * @param  string  The internal URI 
     549   * @param  string The module name 
     550   * @param  string The action name 
     551   * @param  string The cache key 
    536552   * 
    537553   * @return Boolean true if a partial is in the cache, false otherwise 
    538554   */ 
    539   public function hasPartialCache($module, $action, $parameters
    540   { 
    541     return $this->has($this->getPartialUri($module, $action, $parameters)); 
     555  public function hasPartialCache($module, $action, $cacheKey
     556  { 
     557    return $this->has($this->getPartialUri($module, $action, $cacheKey)); 
    542558  } 
    543559 
     
    545561   * Gets a partial template from the cache. 
    546562   * 
    547    * @param  string The internal URI 
     563   * @param  string The module name 
     564   * @param  string The action name 
     565   * @param  string The cache key 
    548566   * 
    549567   * @return string The cache content 
    550568   */ 
    551   public function getPartialCache($module, $action, $parameters
    552   { 
    553     $uri = $this->getPartialUri($module, $action, $parameters); 
     569  public function getPartialCache($module, $action, $cacheKey
     570  { 
     571    $uri = $this->getPartialUri($module, $action, $cacheKey); 
    554572 
    555573    if (!$this->isCacheable($uri)) 
     
    581599   * Sets an action template in the cache. 
    582600   * 
    583    * @param  string The internal URI 
     601   * @param  string The module name 
     602   * @param  string The action name 
     603   * @param  string The cache key 
    584604   * @param  string The content to cache 
    585    * @param  string The view attribute holder to cache 
    586605   * 
    587606   * @return string The cached content 
    588607   */ 
    589   public function setPartialCache($module, $action, $parameters, $content) 
    590   { 
    591     $uri = $this->getPartialUri($module, $action, $parameters); 
     608  public function setPartialCache($module, $action, $cacheKey, $content) 
     609  { 
     610    $uri = $this->getPartialUri($module, $action, $cacheKey); 
    592611    if (!$this->isCacheable($uri)) 
    593612    {