8000 PDO · endeveit/cache Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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();
}

Additional constructor parameters

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_».

Clone this wiki locally
0