public function InvalidationBase::deleteProperty in Purge 8.3
Delete a purger specific property.
Once ::setStateContext() has been called, purgers can call ::setProperty() and ::getProperty() to store specific metadata on the invalidation. The most common usecase for setting properties is for multi-step cache invalidation, for instance CDNs returning IDs to check against later.
Parameters
string $key: The key of the stored property, unique to the current purger context.
Throws
\LogicException Thrown when operating in general context, call ::setStateContext() first.
Overrides InvalidationInterface::deleteProperty
File
- src/
Plugin/ Purge/ Invalidation/ InvalidationBase.php, line 60
Class
- InvalidationBase
- Provides base implementations for the invalidation object.
Namespace
Drupal\purge\Plugin\Purge\InvalidationCode
public function deleteProperty($key) {
if (is_null($this->context)) {
throw new \LogicException('Call ::setStateContext() before deleting properties!');
}
if (isset($this->properties[$this->context][$key])) {
unset($this->properties[$this->context][$key]);
if (empty($this->properties[$this->context])) {
unset($this->properties[$this->context]);
}
}
}