public function DatabaseRawBackend::setMultiple in Supercache 2.0.x
Same name and namespace in other branches
- 8 src/Cache/DatabaseRawBackend.php \Drupal\supercache\Cache\DatabaseRawBackend::setMultiple()
Store multiple items in the persistent cache.
Parameters
array $items: An array of cache items, keyed by cid. In the form:
$items = array(
$cid => array(
// Required.
'data' => $data,
// Optional, defaults to CacheRawBackendInterface::CACHE_PERMANENT.
'expire' => CacheRawBackendInterface::CACHE_PERMANENT,
),
);
Overrides CacheRawBackendInterface::setMultiple
1 call to DatabaseRawBackend::setMultiple()
- DatabaseRawBackend::set in src/
Cache/ DatabaseRawBackend.php - Stores data in the persistent cache.
File
- src/
Cache/ DatabaseRawBackend.php, line 177 - Contains \Drupal\supercache\Cache\DatabaseRawBackend.
Class
- DatabaseRawBackend
- Defines a default cache implementation.
Namespace
Drupal\supercache\CacheCode
public function setMultiple(array $items) {
$try_again = FALSE;
try {
// The bin might not yet exist.
$this
->doSetMultiple($items);
} catch (\Exception $e) {
// If there was an exception, try to create the bins.
if (!($try_again = $this
->ensureBinExists())) {
// If the exception happened for other reason than the missing bin
// table, propagate the exception.
throw $e;
}
}
// Now that the bin has been created, try again if necessary.
if ($try_again) {
$this
->doSetMultiple($items);
}
}