Documentation

DoctrineDbalAdapter extends AbstractAdapter
in package
implements PruneableInterface

Table of Contents

Interfaces

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

Properties

$maxIdLength  : mixed
$apcuSupported  : mixed
$conn  : mixed
$dataCol  : string
$idCol  : string
$lifetimeCol  : string
$marshaller  : mixed
$namespace  : string
$phpFilesSupported  : mixed
$platformName  : string
$serverVersion  : string
$table  : string
$timeCol  : string

Methods

__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()  : void
Creates the table to store cache items which can be called once for setup.
prune()  : bool
doClear()  : bool
{@inheritdoc}
doDelete()  : bool
{@inheritdoc}
doFetch()  : iterable<string|int, mixed>
{@inheritdoc}
doHave()  : bool
{@inheritdoc}
doSave()  : array<string|int, mixed>|bool
{@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 = 0 ][, array<string|int, mixed> $options = [] ][, MarshallerInterface $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 = 0
$options : array<string|int, mixed> = []
$marshaller : MarshallerInterface = null
Tags
throws
InvalidArgumentException

When namespace contains invalid characters

configureSchema()

{@inheritdoc}

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

createConnection()

public static createConnection(string $dsn[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$dsn : string
$options : array<string|int, 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() : void

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

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) : iterable<string|int, mixed>
Parameters
$ids : array<string|int, mixed>
Return values
iterable<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) : array<string|int, mixed>|bool
Parameters
$values : array<string|int, mixed>
$lifetime : int
Return values
array<string|int, mixed>|bool

        
On this page

Search results