This class requires an SQLite database file with 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;
If this does not exist, it will be automatically created in the specified data file.
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)
Empty the cache table in the specified database by dropping and rebuilding the index
public __destruct()
Destroy the SQLite connection
public runGc()
Runs garbage collection for the current cache table
private getDbInstance()
Returns an instance of dbDriverSqlite
private _checkSqliteDbStructure()
Checks and builds as necessary the Sqlite DB structure
Posted by: Scorpio Documentor (Writer), in Cache on 19 Nov 2009 @ 20:30
Tags: cache, cachewriterdatabase, cachewriterdatabasesqlite,
This
work is licenced under a
Creative Commons Licence.