internal package Foswiki::Request::Cache

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Request::Cache

Class that implements a disk cache of Foswiki::Request objects.

There are a couple of cases where we need to cache request objects; over a 403 redirect (which is a GET and therefore has limited parameter capacity) and over a confirmation, such as a strikeone validation. In these cases we need to cache not just the request parameters, but also any uploads associated with the request. We also need the means to keep the cache tidy.

Note that the cache records the method() and path_info() of the original request and restores them on reload.

ClassMethod new()

Construct a new request cache.

ObjectMethod save( $request ) → $uid

$request is a Foswiki::Request object to be cached; the cache is identifiable by the unique $uid, which can be stored and passed to $cache->load(). A cache file will be kept until it is loaded (which destroys the cache) or it is cleaned up.

ObjectMethod load( $uid, $request )

$uid is the id returned by save() which identifies the request cache. $request must be a Foswiki::Request object that will be popluated with the data from the cache. Loading a cache will destroy the cache on disk.

StaticMethod cleanup($timeout)

Clean up the cache by removing everything older than $timeout seconds. If $timeout is 0 or undefined, it defaults to {Sessions}{ExpireAfter}.

Topic revision: r1 - 03 Feb 2016, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding DAMASK? Send feedback