class KeyValueDatabaseExpirableFactory implements KeyValueExpirableFactoryInterface (View source)

Defines the key/value store factory for the database backend.

Properties

protected DatabaseStorageExpirable[] $storages

Holds references to each instantiation so they can be terminated.

protected SerializationInterface $serializer

The serialization class to use.

protected Connection $connection

The database connection.

Methods

__construct(SerializationInterface $serializer, Connection $connection)

Constructs this factory object.

get(string $collection)

Constructs a new expirable key/value store for a given collection name.

garbageCollection()

Deletes expired items.

catchException(Exception $e)

Act on an exception when the table might not have been created.

Details

__construct(SerializationInterface $serializer, Connection $connection)

Constructs this factory object.

Parameters

SerializationInterface $serializer

The serialization class to use.

Connection $connection

The Connection object containing the key-value tables.

KeyValueStoreExpirableInterface get(string $collection)

Constructs a new expirable key/value store for a given collection name.

Parameters

string $collection

The name of the collection holding key and value pairs.

Return Value

KeyValueStoreExpirableInterface

An expirable key/value store implementation for the given $collection.

garbageCollection()

Deletes expired items.

protected catchException(Exception $e)

Act on an exception when the table might not have been created.

If the table does not yet exist, that's fine, but if the table exists and yet the query failed, then the exception needs to propagate.

Parameters

Exception $e

The exception.

Exceptions

Exception