NSWDPC\Utilities\Cloudflare\CloudflarePurgeService
Extends Cloudflare to provide: + Purging by tag, host, prefix (Enterprise) + Purging URLs associated with non SiteTree records (using DataObjectPurgeable) + Usage of the Cloudflare SDK
This class overrides the following methods in + purgeAll()
+ purgeURLs()
Certain methods are handled by :
+ purgePage()
+ purgeImages()
+ purgeCSSAndJavascript()
+ purgeFilesByExtensions()
+ purgeFiles()
- Author: James
Synopsis
class CloudflarePurgeService
extends Cloudflare
{
- // constants
- const TYPE_HOST = 'Host';
- const TYPE_TAG = 'Tag';
- const TYPE_PREFIX = 'Prefix';
- const TYPE_URL = 'URL';
- const TYPE_ENTIRE = 'Entire';
- // members
- private static integer $purge_all_delay = 1;
- private Guzzle $sdk_client;
- // methods
- public void __construct()
- protected CloudflareResult|null result()
- protected Guzzle getSdkClient()
- public CloudflareResult|null purgeAll()
- public CloudflareResult|false purgeTags()
- public CloudflareResult|false purgeHosts()
- public CloudflareResult|false purgeURLs()
- public CloudflareResult|false purgePrefixes()
- public static void getOptionForType()
- public static array getTypeMappings()
Hierarchy
Extends
- Symbiote\Cloudflare\Cloudflare
Constants
Name | Value |
---|---|
TYPE_HOST | 'Host' |
TYPE_TAG | 'Tag' |
TYPE_PREFIX | 'Prefix' |
TYPE_URL | 'URL' |
TYPE_ENTIRE | 'Entire' |
Members
private
- $purge_all_delay — int
- $sdk_client — NSWDPC\Utilities\Cloudflare\Cloudflare\API\Adapter\Guzzle
Methods
protected
- getSdkClient() — Retrieve a cloudflare/sdk client
- result()
public
- __construct()
- getOptionForType() — Get the option for the type
- getTypeMappings() — Map types to the options that can be provided to purge_cache API method called by cachePurge
- purgeAll() — Purge all from zone by creating a cache purge job in the future (which handles the purging) The idea here is that job will be created in the future with a configured delay (hrs) This allows job cancellation and manual actioning Only members with the permission ADMIN may create this job (in this method)
- purgeHosts() — Purge cache by hosts immediately using cloudflare/sdk
- purgePrefixes() — Have to do this directly via the Adapter for the moment
- purgeTags() — Purge cache by tags immediately using cloudflare/sdk
- purgeURLs() — Purge cache by urls immediately using cloudflare/sdk This method modifies the URLs provided to ensure they are absolute URLs