Documentation

DoctrineDbalAdapter extends AbstractAdapter
in package
implements PruneableInterface

Interfaces, Classes and Traits

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
$dataCol  : mixed
$idCol  : mixed
$lifetimeCol  : mixed
$marshaller  : mixed
$namespace  : mixed
$phpFilesSupported  : mixed
$platformName  : mixed
$serverVersion  : mixed
$table  : mixed
$timeCol  : mixed
__construct()  : mixed
You can either pass an existing database Doctrine DBAL Connection or a DSN string that will be used to connect to the database.
commit()  : bool
{@inheritdoc}
configureSchema()  : void
{@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()  : bool
{@inheritdoc}
doDelete()  : bool
{@inheritdoc}
doFetch()  : iteratable<string|int, mixed>
{@inheritdoc}
doHave()  : bool
{@inheritdoc}
doSave()  : mixed
{@inheritdoc}
addTableToSchema()  : void
getPlatformName()  : string
getServerVersion()  : string

Properties

Methods

__construct()

You can either pass an existing database Doctrine DBAL Connection or a DSN string that will be used to connect to the database.

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

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]
Parameters
$connOrDsn : Connection|string
$namespace : string = ''
$defaultLifetime : int
$options : array<string|int, mixed> = []
$marshaller : MarshallerInterface|null = null
Tags
throws
InvalidArgumentException

When namespace contains invalid characters

Return values
mixed

commit()

{@inheritdoc}

public commit() : bool
Return values
bool

configureSchema()

{@inheritdoc}

public configureSchema(Schema $schema, Connection $forConnection) : void
Parameters
$schema : Schema
$forConnection : Connection
Return values
void

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|null $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 = 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
Exception

When the table already exists

Return values
mixed

doClear()

{@inheritdoc}

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

doDelete()

{@inheritdoc}

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

doFetch()

{@inheritdoc}

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

doHave()

{@inheritdoc}

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

doSave()

{@inheritdoc}

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

addTableToSchema()

private addTableToSchema(Schema $schema) : void
Parameters
$schema : Schema
Return values
void

Search results