internal package
Foswiki::PageCache internal package
Foswiki::PageCache The dependency graph records all topics that have been touched while the current page is being computed. It also records the session and url parameters that were in use, part of which is the user name as well.
An edge in the dependency graph consists of:
For every cached page there's a record of meta data describing it:
ClassMethod
new( ) → $object Construct a new page cache
ObjectMethod
genVariationKey() → $key Generate a key for the current webtopic being produced; this reads information from the current session and url params, as follows: * the server serving the request (HTTP_HOST) * the port number of the server serving the request (HTTP_PORT) * the action used to render the page (view or rest) * the language of the current session, if any * all session parameters EXCEPT: o Those starting with an underscore o VALIDATION o REMEMBER o FOSWIKISTRIKEONE.* o VALID_ACTIONS.* o BREADCRUMB_TRAIL o DGP_hash * all HTTP request parameters EXCEPT: o All those starting with an underscore o refresh o foswiki_redirect_cache o logout o topic o cache_ignore o cache_expire
ObjectMethod
cachePage($contentType, $data) → $boolean Cache a page. Every page is stored in a page bucket that contains all variations (stored for other users or other session parameters) of this page, as well as dependency and expiration information
ObjectMethod
getPage($web, $topic) Retrieve a cached page for the given web.topic, using a variation key based on the current session.
ObjectMethod
setPageVariation($web, $topici, $variationKey, $variation) → $bool stores a rendered page
ObjectMethod
getPageVariation($web, $topic, $variationKey) retrievs a cache entry; returns undef if there is none.
Checks whether the current page is cacheable. It first checks the "refresh" url parameter and then looks out for the "CACHEABLE" preference variable.
ObjectMethod
addDependencyForLink($web, $topic) Add a reference to a web.topic to the dependencies of the current page.
Topic references, unlike hard dependencies, may cause internal links - WikiWords to render incorrectly unless the cache is cleared when the topic changes. (i.e, link to a missing topic, or render as a "new link" for a newly existing topic).This routine is configurable using {Cache}{TrackInternalLinks}. By default, it treats all topic references as simple dependencies. If disabled, link references are ignored, but if set to authenticated, links are tracked only for logged in users.
ObjectMethod
addDependency($web, $topic) Add a web.topic to the dependencies of the current page
ObjectMethod
getDependencies($web, $topic, $variationKey) → \@deps Return dependencies for a given web.topic. if $variationKey is specified, only dependencies of this page variation will be returned.
ObjectMethod
getWebDependencies($web) → \@deps Returns dependencies that hold for all topics in a web.
ObjectMethod
setDependencies($web, $topic, $variation, @topics) Stores the dependencies for the given web.topic topic. Setting the dependencies happens at the very end of a rendering process of a page while it is about to be cached.
When the optional @topics parameter isn't provided, then all dependencies collected in the Foswiki::PageCache object will be used. These dependencies are collected during the rendering process.ObjectMethod
deleteDependencies($web, $topic, $variation, $force) ObjectMethod
deletePage($web, $topic, $variation, $force) Remove a page from the cache; this removes all of the information that we have about this page, including any dependencies that have been established while this page was created.
If $variation is specified, only this variation of $web.$topic will be removed. When $variation is not specified, all page variations of $web.$topic will be removed.
When $force is true, the deletion will take place immediately. Otherwise all delete requests might be delayed and committed as part of Foswiki::PageCache::finish().ObjectMethod
deleteAll() purges all of the cache
ObjectMethod
fireDependency($web, $topic) This method is called to remove all other cache entries that used the given $web.$topic as an ingredience to produce the page.
A dependency is a directed edge starting from a page variation being rendered towards a depending page that has been used to produce it.
While dependency edges are stored as they are collected during the rendering process, these edges are traversed in reverse order when a dependency is fired.
In addition all manually asserted dependencies of topics in a web are deleted, as well as the given topic itself.
ObjectMethod
renderDirtyAreas($text) Extract dirty areas and render them; this happens after storing a page including the un-rendered dirty areas into the cache and after retrieving it again.
ObjectMethod
finish() clean up finally