public function ChainedStorageExpirable::__construct in Supercache 2.0.x
Same name and namespace in other branches
- 8 src/KeyValueStore/ChainedStorageExpirable.php \Drupal\supercache\KeyValueStore\ChainedStorageExpirable::__construct()
Overrides Drupal\Core\KeyValueStore\StorageBase::__construct().
Parameters
CacheFactoryInterface $factory: The cache backend factory.
string $collection: The name of the collection holding key and value pairs.
\Drupal\Component\Serialization\SerializationInterface $serializer: The serialization class to use.
\Drupal\Core\Database\Connection $connection: The database connection to use.
string $table: The name of the SQL table to use, defaults to key_value.
Overrides DatabaseStorageExpirable::__construct
File
- src/
KeyValueStore/ ChainedStorageExpirable.php, line 48 - Contains \Drupal\supercache\KeyValueStore\ChainedStorageExpirable.
Class
- ChainedStorageExpirable
- Defines a default key/value store implementation for expiring items.
Namespace
Drupal\supercache\KeyValueStoreCode
public function __construct(CacheFactoryInterface $factory, $collection, SerializationInterface $serializer, Connection $connection, $table = 'key_value_expire') {
parent::__construct($collection, $serializer, $connection, $table);
// Make sure the collection name passed to the cache factory
// does not have any dots, or else if using database storage it will
// crash.
$sanitized_collection = preg_replace('/[^A-Za-z0-9_]+/', '_', $collection);
$this->cache = $factory
->get($table . '_' . $sanitized_collection);
}