I’m working in a custom clientscript component. Therefore i looked at the source of CClientScript and found, that all register*() calls get recorded by the cache. For example:
public function registerCssFile($url,$media='')
{
$this->hasScripts=true;
$this->cssFiles[$url]=$media;
$params=func_get_args();
$this->recordCachingAction('clientScript','registerCssFile',$params);
return $this;
}
That means, these methods are replayed, even if a cached version of a page is found. From COutputCache:
public function init()
{
if($this->getIsContentCached())
$this->replayActions();
[ ... ]
}
I don’t really understand, what this is for. As i see it, the cached page content should already have the JS + CSS inserted, because the script tags get inserted before the page is cached. Or am i wrong here?
The only reason i could think of, is, to make sure, that any assets are published again, in case someone cleared the assets folder.
Can someone explain, why these methods are recorded?