$basepath
$basepath :
get(string $cacheName, string $key, integer $maxAge = false) : string
Retrieves cached data based on the cache name and key requested. By default cache does not expire.
Example Usage:
$htmlToDisplay = cacheSys::get('outputHTMLCategory', md5('filenameOutputKey'));
if($htmlToDisplay===false) { //perform resource intensive logic here, eventually saving the output or data to the cache }
echo $htmlToDisplay;
| string | $cacheName | any alpha-numeric string. used to categorize cache types. |
| string | $key | any alpha-numeric string unique within the cache category. |
| integer | $maxAge | how old a cache file is allowed to be (in seconds) |
the contents of the cache category/key combo. FALSE if the cache is not found.
put(string $cacheName, string $key, string $content) : boolean
Stores content in the cache. uses the category and key variables to enable retreival
Example Usage:
$htmlToDisplay = cacheSys::put('outputHTMLCategory', md5('filenameOutputKey'), 'content to store');
if($htmlToDisplay===false) { //perform resource intensive logic here, eventually saving the output or data to the cache }
echo $htmlToDisplay;
| string | $cacheName | any alpha-numeric string. used to categorize cache types. |
| string | $key | any alpha-numeric string unique within the cache category. |
| string | $content | any string to store in the cache |
returns true if successful
deleteCachedCategory(string $category) : boolean
Deletes all cached copies of items within a specified category.
Example Usage:
$cacheDeleted = cacheSys::deleteCachedCategory('outputHTMLCategory');
| string | $category | any alpha-numeric string used to categorize cache types. |
returns true if cache stores were deleted, false if no cache stores exist
deleteCachedItem(string $category, string $key) : boolean
Delete a specified cached copy within a specified category.
Example Usage:
$cacheDeleted = cacheSys::deleteCachedItem('outputHTMLCategory', md5('filenameOutputKey'));
| string | $category | any alpha-numeric string used to categorize cache types. |
| string | $key | any alpha-numeric string used to uniquely identify the item to delete. |
returns true if a cached copy was deleted, false if no cache existed
deleteCachedItems(string $category, string $key = null) : boolean
Delete a cached files with a specfied string in the file name
Example Usage:
$cacheDeleted = cacheSys::deleteCachedItems('outputHTMLCategory', 'stringInFilename');
| string | $category | any alpha-numeric string used to categorize cache types. |
| string | $key | any alpha-numeric string used to uniquely identify the item to delete. |
returns true if a cached copy was deleted, false if no cache existed