Add support for host-based cache purge

This commit is contained in:
Max Ivanov
2018-08-23 16:13:56 +01:00
parent 63be6cf154
commit c9d2782b88
3 changed files with 40 additions and 5 deletions

View File

@@ -158,15 +158,16 @@ class Zones implements API
return false;
}
public function cachePurge(string $zoneID, array $files = null, array $tags = null): bool
public function cachePurge(string $zoneID, array $files = null, array $tags = null, array $hosts = null): bool
{
if ($files === null && $tags === null) {
throw new EndpointException('No files or tags to purge.');
if ($files === null && $tags === null && $hosts === null) {
throw new EndpointException('No files, tags or hosts to purge.');
}
$options = [
'files' => $files,
'tags' => $tags
'tags' => $tags,
'hosts' => $hosts
];
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);