-
Notifications
You must be signed in to change notification settings - Fork 4
Nikita Vershinin edited this page Jul 3, 2013
·
2 revisions
Only MySQL and SQLite PDO drivers available at the moment.
To instantiate PDO cache driver you should write:
<?php
require '/path/to/vendor/autoload.php';
// Create the PDO_SQLITE instance and instantiate the cache driver
$dbh = new \PDO('sqlite:/path/to/cache.db');
$cache = new Endeveit\Cache\Drivers\Pdo\SQLite($dbh);
// or PDO_MYSQL
$dbh = new \PDO('mysql:host=hostname;dbname=test', 'username', 'password');
$cache = new Endeveit\Cache\Drivers\Pdo\MySQL($dbh);
// If this is the first run, you must build the tables structure
if (isFirstRun()) {
$cache->buildStructure();
}
PDO driver takes additional parameter $prefix in constructor.
It is used as a prefix for tables with cache data in your database.
Defaults to «cache_».