The sfViewCacheManager::addCache() method allows to define a server side cache lifetime (used by symfony) and a client side cache lifetime (used by proxies and browsers).
For a specific use, I want a server-side lifetime of 10 seconds, but a client-side lifetime of 0. So I just register my cache as follows:
$viewCacheManager->addCache('mymodule', 'myction', array(
'withLayout' => true,
'lifeTime' => 10,
'clientLifeTime' => 0,
'contextual' => false,
'vary' => array ()
));
The problem is that line 172 of the sfViewCacheManager, the addCache() method just ignores the client lifetime if it is equal to zero:
$this->cacheConfig[$moduleName][$actionName] = array(
'withLayout' => isset($options['withLayout']) ? $options['withLayout'] : false,
'lifeTime' => $options['lifeTime'],
'clientLifeTime' => isset($options['clientLifeTime']) ? $options['clientLifeTime'] : $options['lifeTime'],
'contextual' => isset($options['contextual']) ? $options['contextual'] : false,
'vary' => isset($options['vary']) ? $options['vary'] : array(),
);
So I end up with a cache configuration of 10s lifetime for both the server side and the client side, which is not what I want.
Attached is a simple patch to fix this.