This class requires a table with the following schema:
CREATE TABLE `dataCache` ( `cacheId` varchar(255) NOT NULL, `data` mediumtext NOT NULL, `createDate` datetime NOT NULL, `updateDate` datetime NOT NULL, `lifetime` int(10) NOT NULL default '3600', UNIQUE KEY `cacheId` (`cacheId`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Note: there are some small differences between this writer and the file writer. Using isCached() and isExpired() will automatically trigger a load from the database. If not, each would require a separate query; a select 1 from..., select (now()-unix_timestamp(update_time))>lifetime from...) and a select.
public static clearCache($inCacheDatabase, $inCacheTable)
Removes all cached records from $inCacheDatabase.$inCacheTable, returns number of rows affected
public runGc()
Runs garbage collection for the current cache table