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-
21           existent 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
26               current time plus duration (instead of removing it from the
27               cache) before returning undef.  This is used to prevent
28               multiple processes from recomputing the same expensive value
29               simultaneously. The duration may be of any form acceptable to
30               set.
31
32           expire_if => sub
33               If the value exists and has not expired, call sub with the
34               cache object as a single parameter. If sub returns a true
35               value, expire the value.
36
37       get_object (key)
38           Returns the underlying "Cache::Object" object associated with key.
39           The most useful methods on this object are
40
41               $co->get_created_at();    # when was object stored in cache
42               $co->get_accessed_at();   # when was object last accessed
43               $co->get_expires_at();    # when does object expire
44
45       expire (key)
46           Expires the value associated with key, if it exists. Differs from
47           remove only in that the cache object is left around, e.g. for
48           retrieval by get_object.
49
50       remove (key)
51           Removes the cache object associated with key, if it exists.
52
53       set (key, data, [duration])
54           Associates data with key in the cache. duration indicates the time
55           until the value should be erased.  If duration is unspecified, the
56           value will never expire by time.
57
58           $expires_in may be a simple number of seconds, or a string of the
59           form "[number] [unit]", e.g., "10 minutes".  The valid units are s,
60           second, seconds, sec, m, minute, minutes, min, h, hour, hours, d,
61           day, days, w, week, weeks, M, month, months, y, year, and years.
62
63
64
65perl v5.34.0                      2022-01-21  HTML::Mason::Cache::BaseCache(3)
Impressum