1HTML::Mason::Cache::BasUesCearchCeo(n3t)ributed Perl DocHuTmMeLn:t:aMtaisoonn::Cache::BaseCache(3)
2
3
4

NAME

6       HTML::Mason::Cache::BaseCache - Base cache object
7

DESCRIPTION

9       This is the base module for all cache implementations used in Mason.
10       It provides a few additional methods on top of "Cache::BaseCache" in
11       Dewitt Clinton's "Cache::Cache" package.
12
13       An object of this class is returned from $m->cache.
14

METHODS

16       clear ()
17           Remove all values in the cache.
18
19       get (key, [%params])
20           Returns the value associated with key or undef if it is non-exis‐
21           tent or expired. This is extended with the following optional
22           name/value parameters:
23
24           busy_lock => duration
25               If the value has expired, set its expiration time to the cur‐
26               rent time plus duration (instead of removing it from the cache)
27               before returning undef.  This is used to prevent multiple pro‐
28               cesses from recomputing the same expensive value simultane‐
29               ously. The duration may be of any form acceptable to set.
30
31           expire_if => sub
32               If the value exists and has not expired, call sub with the
33               cache object as a single parameter. If sub returns a true
34               value, expire the value.
35
36       get_object (key)
37           Returns the underlying "Cache::Object" object associated with key.
38           The most useful methods on this object are
39
40               $co->get_created_at();    # when was object stored in cache
41               $co->get_accessed_at();   # when was object last accessed
42               $co->get_expires_at();    # when does object expire
43
44       expire (key)
45           Expires the value associated with key, if it exists. Differs from
46           remove only in that the cache object is left around, e.g. for
47           retrieval by get_object.
48
49       remove (key)
50           Removes the cache object associated with key, if it exists.
51
52       set (key, data, [duration])
53           Associates data with key in the cache. duration indicates the time
54           until the value should be erased.  If duration is unspecified, the
55           value will never expire by time.
56
57           $expires_in may be a simple number of seconds, or a string of the
58           form "[number] [unit]", e.g., "10 minutes".  The valid units are s,
59           second, seconds, sec, m, minute, minutes, min, h, hour, hours, d,
60           day, days, w, week, weeks, M, month, months, y, year, and years.
61
62
63
64perl v5.8.8                       2007-04-17  HTML::Mason::Cache::BaseCache(3)
Impressum