/** * Direct invocation of the constructor is not permitted. */ protected function __construct() { $dir = \RX_BASEDIR . 'files/cache/store'; if (!Storage::isDirectory($dir)) { Storage::createDirectory($dir); } $key = substr(hash_hmac('sha256', $dir, config('crypto.authentication_key')), 0, 32); $filename = "{$dir}/{$key}.db"; if (Storage::exists($filename)) { $this->_connect($filename); } else { $this->_connect($filename); for ($i = 0; $i < 32; $i++) { $this->_dbh->exec('CREATE TABLE cache_' . $i . ' (k TEXT PRIMARY KEY, v TEXT, exp INT)'); } } }