[dokuwiki] Re: How are page caches updated wrt in/existing links?

Chris,
Thanks for the hint!

On my start page, I've created a link to [[newpage]].
I've created this page by clicking on the link and the button 'create the
page'.
No problem, it's created there.
Going back to the start page, the link becomes blue (file exist), by some
'magic' !

I've inserted a logging device into the class cache, printing the key and
dependencies:
  function useCache($depends=array()) {
    $this->depends = $depends;
    $this->_addDependencies();
    if ($this->_event) {
      //return
$this->_stats(trigger_event($this->_event,$this,array($this,'_useCache')));
//OLD
      $_useCache =
trigger_event($this->_event,$this,array($this,'_useCache'));
    } else {
      //return $this->_stats($this->_useCache()); //OLD
      $_useCache = $this->_useCache();
    }
    logMe('cache usekey='.$this->key.' use='.$_useCache); //NEW SPY
    logMe('cache    dep='.join(',',$this->depends['files'])); //NEW SPY
    return $this->_stats($_useCache);
  }
For Key= ~/data/pages/start.txt127.0.0.180 my spy gave me files like:
~/conf/dokuwiki.php, ~/conf/local.php, ~/inc/parser/parser.php,
~/inc/parser/handler.php, ~/inc/parser/xhtml.php, ~/data/meta/start.meta,
~/inc/parser/metadata.php

I'm sure that the dependencies of start doesn't include
~/data/pages/newpage.txt.
What is funny is that sometimes $_useCache is true, sometimes its false...

I'm still looking for the 'magic' that makes it work!


2007/11/5, Chris Smith <chris@xxxxxxxxxxxxx>:
>
> Take a look at inc/cache.php.  In particular _usecache() method for
> cache_renderer class.  That function checks for changes in the existence
> of the page's internal wiki links, invalidating the cache if its finds
> any.  Those links along with existence information are recorded by the
> metadata renderer in the page's metadata.
>
> Fwiw, my contention is that the DW cache logic is sophisticated and
> accurate enough to allow wikiadmins to set long cache times
> ($conf['cachetime']) when there is no chance of pages being updated
> outside DW(1).  One rider to this is using plugins that change page
> content outside of the direct page editing process and don't include an
> action component to handle any cache validation required by that
> updating.  For an example of a plugin that does this correctly, refer to
> the include plugin.
>
> (1) This can have a large effect on the perceived speed/responsiveness
> of DW.  On my server it can take more than 10 times as long to generate
> a page from instructions as it does to show a page from cache,  70ms v
> 700ms+.  For pages that are viewed infrequently with respect to the
> cache time, this can mean they are being generated on many/most views.
>
> -- Chris
>
>
> YC Chan wrote:
> > I would like to know what this class information is updated when a page
> is
> > rendered from its cache.
> >
> > I got to around the p_cached_output function:
> > when useCache() returns true, the parsed version is retrieved from
> cache.
> > else, a new version is produced and saved in the cache.
> >
> > I don't understand how the link class is updated. In a sample case, I
> > printed out the cache dependancies.
> > There wasn't even the referenced link in the dependancies, but the link
> was
> > properly updated.
>

Other related posts: