{
    "content": [
        {
            "type": "text",
            "text": "# Cache::Cache (info)\n\n## NAME\n\nCache::Cache -- the Cache interface.\n\n## DESCRIPTION\n\nThe Cache modules are designed to assist a developer in persisting data\nfor a specified period of time.  Often these modules are used in web\napplications to store data locally to save repeated and redundant\nexpensive calls to remote machines or databases.  People have also been\nknown to use Cache::Cache for its straightforward interface in sharing\ndata between runs of an application or invocations of a CGI-style\nscript or simply as an easy to use abstraction of the filesystem or\nshared memory.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION**\n- **USAGE**\n- **CONSTANTS**\n- **METHODS**\n- **OPTIONS**\n- **PROPERTIES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Cache::Cache",
        "section": "",
        "mode": "info",
        "summary": "Cache::Cache -- the Cache interface.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 26,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 35,
                "subsections": []
            },
            {
                "name": "CONSTANTS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 56,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "PROPERTIES",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Cache::Cache -- the Cache interface.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The Cache modules are designed to assist a developer in persisting data\nfor a specified period of time.  Often these modules are used in web\napplications to store data locally to save repeated and redundant\nexpensive calls to remote machines or databases.  People have also been\nknown to use Cache::Cache for its straightforward interface in sharing\ndata between runs of an application or invocations of a CGI-style\nscript or simply as an easy to use abstraction of the filesystem or\nshared memory.\n\nThe Cache::Cache interface is implemented by classes that support the\nget, set, remove, size, purge, and clear instance methods and their\ncorresponding static methods for persisting data across method calls.\n\nCACHE::CACHE VERSUS CHI\nCache::Cache is in wide use and very stable, but has not changed in\nyears and is no longer actively developed.\n\nCHI is the successor to Cache::Cache. It adheres to the basic\nCache::Cache API but adds new features and drivers (e.g. FastMmap and\nMemcached), improves performance, and addresses limitations in the\nCache::Cache implementation. The authors recommend the use of CHI going\nforward.\n\nQuestions about Cache::Cache and CHI may be directed to the perl-cache\nmailing list at http://groups.google.com/group/perl-cache-discuss.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "First, choose the best type of cache implementation for your needs.\nThe simplest cache is the MemoryCache, which is suitable for\napplications that are serving multiple sequential requests, and wish to\navoid making redundant expensive queries, such as an Apache/modperl\napplication talking to a database.  If you wish to share that data\nbetween processes, then perhaps the SharedMemoryCache is appropriate,\nalthough its behavior is tightly bound to the underlying IPC mechanism,\nwhich varies from system to system, and is unsuitable for large objects\nor large numbers of objects.  When the SharedMemoryCache is not\nacceptable, then FileCache offers all of the same functionality with\nsimilar performance metrics, and it is not limited in terms of the\nnumber of objects or their size.  If you wish to maintain a strict\nlimit on the size of a file system based cache, then the\nSizeAwareFileCache is the way to go.  Similarly, the\nSizeAwareMemoryCache and the SizeAwareSharedMemoryCache add size\nmanagement functionality to the MemoryCache and SharedMemoryCache\nclasses respectively.\n\nUsing a cache is simple.  Here is some sample code for instantiating\nand using a file system based cache.\n\nuse Cache::FileCache;\n\nmy $cache = new Cache::FileCache( );\n\nmy $customer = $cache->get( $name );\n\nif ( not defined $customer )\n{\n$customer = getcustomerfromdb( $name );\n$cache->set( $name, $customer, \"10 minutes\" );\n}\n\nreturn $customer;\n",
                "subsections": []
            },
            "CONSTANTS": {
                "content": "$EXPIRESNEVER\nThe item being set in the cache will never expire.\n\n$EXPIRESNOW\nThe item being set in the cache will expire immediately.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Clear( )\nRemove all objects from all caches of this type.\n\nPurge( )\nRemove all objects that have expired from all caches of this type.\n\nSize( )\nReturns the total size of all objects in all caches of this type.\n\nnew( $optionshashref )\nConstruct a new instance of a Cache::Cache. $optionshashref is a\nreference to a hash containing configuration options; see the\nsection OPTIONS below.\n\nclear(  )\nRemove all objects from the namespace associated with this cache\ninstance.\n\nget( $key )\nReturns the data associated with $key.\n\ngetobject( $key )\nReturns the underlying Cache::Object object used to store the\ncached data associated with $key.  This will not trigger a removal\nof the cached object even if the object has expired.\n\npurge(  )\nRemove all objects that have expired from the namespace associated\nwith this cache instance.\n\nremove( $key )\nDelete the data associated with the $key from the cache.\n\nset( $key, $data, [$expiresin] )\nAssociates $data with $key in the cache. $expiresin indicates the\ntime in seconds until this data should be erased, or the constant\n$EXPIRESNOW, or the constant $EXPIRESNEVER.  Defaults to\n$EXPIRESNEVER.  This variable can also be in the extended format\nof \"[number] [unit]\", e.g., \"10 minutes\".  The valid units are s,\nsecond, seconds, sec, m, minute, minutes, min, h, hour, hours, d,\nday, days, w, week, weeks, M, month, months, y, year, and years.\nAdditionally, $EXPIRESNOW can be represented as \"now\" and\n$EXPIRESNEVER can be represented as \"never\".\n\nsetobject( $key, $object )\nAssociates $key with Cache::Object $object.  Using setobject (as\nopposed to set) does not trigger an automatic removal of expired\nobjects.\n\nsize(  )\nReturns the total size of all objects in the namespace associated\nwith this cache instance.\n\ngetnamespaces( )\nReturns all the namespaces associated with this type of cache.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "The options are set by passing in a reference to a hash containing any\nof the following keys:\n\nnamespace\nThe namespace associated with this cache.  Defaults to \"Default\" if\nnot explicitly set.\n\ndefaultexpiresin\nThe default expiration time for objects place in the cache.\nDefaults to $EXPIRESNEVER if not explicitly set.\n\nautopurgeinterval\nSets the auto purge interval.  If this option is set to a\nparticular time ( in the same format as the expiresin ), then the\npurge( ) routine will be called during the first set after the\ninterval expires.  The interval will then be reset.\n\nautopurgeonset\nIf this option is true, then the auto purge interval routine will\nbe checked on every set.\n\nautopurgeonget\nIf this option is true, then the auto purge interval routine will\nbe checked on every get.\n",
                "subsections": []
            },
            "PROPERTIES": {
                "content": "(get|set)namespace( )\nThe namespace of this cache instance\n\ngetdefaultexpiresin( )\nThe default expiration time for objects placed in this cache\ninstance\n\ngetkeys( )\nThe list of keys specifying objects in the namespace associated\nwith this cache instance\n\ngetidentifiers( )\nThis method has been deprecated in favor of getkeys( ).\n\n(get|set)autopurgeinterval( )\nAccesses the auto purge interval.  If this option is set to a\nparticular time ( in the same format as the expiresin ), then the\npurge( ) routine will be called during the first get after the\ninterval expires.  The interval will then be reset.\n\n(get|set)autopurgeonset( )\nIf this property is true, then the auto purge interval routine will\nbe checked on every set.\n\n(get|set)autopurgeonget( )\nIf this property is true, then the auto purge interval routine will\nbe checked on every get.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CHI - the successor to Cache::Cache\n\nCache::Object, Cache::MemoryCache, Cache::FileCache,\nCache::SharedMemoryCache, and Cache::SizeAwareFileCache\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Original author: DeWitt Clinton <dewitt@unto.net>\n\nLast author:     $Author: dclinton $\n\nCopyright (C) 2001-2003 DeWitt Clinton\n\nperl v5.20.2                      2015-01-22                 Cache::Cache(3pm)",
                "subsections": []
            }
        }
    }
}