{
    "mode": "perldoc",
    "parameter": "HTML::Mason::Cache::BaseCache",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTML%3A%3AMason%3A%3ACache%3A%3ABaseCache/json",
    "generated": "2026-06-09T13:44:01Z",
    "sections": {
        "NAME": {
            "content": "HTML::Mason::Cache::BaseCache - Base cache object\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This is the base module for all cache implementations used in Mason. It provides a few\nadditional methods on top of \"Cache::BaseCache\" in Dewitt Clinton's \"Cache::Cache\" package.\n\nAn object of this class is returned from $m->cache.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "clear ()\nRemove all values in the cache.\n\nget (key, [%params])\nReturns the value associated with *key* or undef if it is non-existent or expired. This is\nextended with the following optional name/value parameters:\n\nbusylock => duration\nIf the value has expired, set its expiration time to the current time plus *duration*\n(instead of removing it from the cache) before returning undef. This is used to prevent\nmultiple processes from recomputing the same expensive value simultaneously. The\n*duration* may be of any form acceptable to set.\n\nexpireif => sub\nIf the value exists and has not expired, call *sub* with the cache object as a single\nparameter. If *sub* returns a true value, expire the value.\n\ngetobject (key)\nReturns the underlying \"Cache::Object\" object associated with *key*. The most useful methods\non this object are\n\n$co->getcreatedat();    # when was object stored in cache\n$co->getaccessedat();   # when was object last accessed\n$co->getexpiresat();    # when does object expire\n\nexpire (key)\nExpires the value associated with *key*, if it exists. Differs from remove only in that the\ncache object is left around, e.g. for retrieval by getobject.\n\nremove (key)\nRemoves the cache object associated with *key*, if it exists.\n\nset (key, data, [duration])\nAssociates *data* with *key* in the cache. *duration* indicates the time until the value\nshould be erased. If *duration* is unspecified, the value will never expire by time.\n\n*$expiresin* may be a simple number of seconds, or a string of the form \"[number] [unit]\",\ne.g., \"10 minutes\". The valid units are s, second, seconds, sec, m, minute, minutes, min, h,\nhour, hours, d, day, days, w, week, weeks, M, month, months, y, year, and years.\n",
            "subsections": []
        }
    },
    "summary": "HTML::Mason::Cache::BaseCache - Base cache object",
    "flags": [],
    "examples": [],
    "see_also": []
}