FileAccess Orion

PdoAdapter extends AbstractAdapter
in package
implements PruneableInterface

Interfaces, Classes, Traits and Enums

PruneableInterface
Interface extends psr-6 and psr-16 caches to allow for pruning (deletion) of all expired cache items.

Table of Contents

$maxIdLength  : mixed
$apcuSupported  : mixed
$conn  : mixed
$connectionOptions  : mixed
$dataCol  : mixed
$driver  : mixed
$dsn  : mixed
$idCol  : mixed
$lifetimeCol  : mixed
$marshaller  : mixed
$namespace  : mixed
$password  : mixed
$phpFilesSupported  : mixed
$serverVersion  : mixed
$table  : mixed
$timeCol  : mixed
$username  : mixed
__construct()  : mixed
You can either pass an existing database connection as PDO instance or a Doctrine DBAL Connection or a DSN string that will be used to lazy-connect to the database when the cache is actually used.
commit()  : bool
{@inheritdoc}
createConnection()  : mixed
createSystemCache()  : AdapterInterface
Returns the best possible adapter that your runtime supports.
createTable()  : mixed
Creates the table to store cache items which can be called once for setup.
prune()  : bool
doClear()  : mixed
{@inheritdoc}
doDelete()  : mixed
{@inheritdoc}
doFetch()  : mixed
{@inheritdoc}
doHave()  : mixed
{@inheritdoc}
doSave()  : mixed
{@inheritdoc}
getConnection()  : PDO|Connection
getServerVersion()  : string

Properties

$connectionOptions

private mixed $connectionOptions = []

$lifetimeCol

private mixed $lifetimeCol = 'item_lifetime'

Methods

__construct()

You can either pass an existing database connection as PDO instance or a Doctrine DBAL Connection or a DSN string that will be used to lazy-connect to the database when the cache is actually used.

public __construct(PDO|Connection|string $connOrDsn[, string $namespace = '' ], int $defaultLifetime[, array<string|int, mixed> $options = [] ][, MarshallerInterface $marshaller = null ]) : mixed

When a Doctrine DBAL Connection is passed, the cache table is created automatically when possible. Otherwise, use the createTable() method.

List of available options:

  • db_table: The name of the table [default: cache_items]
  • db_id_col: The column where to store the cache id [default: item_id]
  • db_data_col: The column where to store the cache data [default: item_data]
  • db_lifetime_col: The column where to store the lifetime [default: item_lifetime]
  • db_time_col: The column where to store the timestamp [default: item_time]
  • db_username: The username when lazy-connect [default: '']
  • db_password: The password when lazy-connect [default: '']
  • db_connection_options: An array of driver-specific connection options [default: []]
Parameters
$connOrDsn : PDO|Connection|string

a \PDO or Connection instance or DSN string or null

$namespace : string = ''
$defaultLifetime : int
$options : array<string|int, mixed> = []
$marshaller : MarshallerInterface = null
Tags
throws
InvalidArgumentException

When first argument is not PDO nor Connection nor string

throws
InvalidArgumentException

When PDO error mode is not PDO::ERRMODE_EXCEPTION

throws
InvalidArgumentException

When namespace contains invalid characters

Return values
mixed

commit()

{@inheritdoc}

public commit() : bool
Return values
bool

createConnection()

public static createConnection(string $dsn[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$dsn : string
$options : array<string|int, mixed> = []
Return values
mixed

createSystemCache()

Returns the best possible adapter that your runtime supports.

public static createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory[, LoggerInterface $logger = null ]) : AdapterInterface

Using ApcuAdapter makes system caches compatible with read-only filesystems.

Parameters
$namespace : string
$defaultLifetime : int
$version : string
$directory : string
$logger : LoggerInterface = null
Return values
AdapterInterface

createTable()

Creates the table to store cache items which can be called once for setup.

public createTable() : mixed

Cache ID are saved in a column of maximum length 255. Cache data is saved in a BLOB.

Tags
throws
PDOException

When the table already exists

throws
DBALException

When the table already exists

throws
DomainException

When an unsupported PDO driver is used

Return values
mixed

prune()

public prune() : bool
Return values
bool

doClear()

{@inheritdoc}

protected doClear(string $namespace) : mixed
Parameters
$namespace : string
Return values
mixed

doDelete()

{@inheritdoc}

protected doDelete(array<string|int, mixed> $ids) : mixed
Parameters
$ids : array<string|int, mixed>
Return values
mixed

doFetch()

{@inheritdoc}

protected doFetch(array<string|int, mixed> $ids) : mixed
Parameters
$ids : array<string|int, mixed>
Return values
mixed

doHave()

{@inheritdoc}

protected doHave(string $id) : mixed
Parameters
$id : string
Return values
mixed

doSave()

{@inheritdoc}

protected doSave(array<string|int, mixed> $values, int $lifetime) : mixed
Parameters
$values : array<string|int, mixed>
$lifetime : int
Return values
mixed

getConnection()

private getConnection() : PDO|Connection
Return values
PDO|Connection

getServerVersion()

private getServerVersion() : string
Return values
string

Search results