Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/teamdeeson/cf_purge

A Drupal module to provide programmatic purging of the Cloudflare cache
https://github.com/teamdeeson/cf_purge

Last synced: 18 days ago
JSON representation

A Drupal module to provide programmatic purging of the Cloudflare cache

Awesome Lists containing this project

README

        

# CF Purge - Cloudflare cache purge service.

This module allows the programmatic purging of the Cloudflare cache.

## Getting started.

Add the following to the `repositories` section of your site's `composer.json` file

```javascript
{
"type": "vcs",
"url": "https://github.com/teamdeeson/cf_purge.git"
}
```

### Add the following config to settings

```php
purgeByUrl($urls);
```

## Purging everything.

To purge the whole Cloudflare cache, there is this function available:

```php
$purge_service = \Drupal::service('cf_purge.service');
$purge_service->purgeAll();
```

## Drush command utility.

There is a drush command file which allows you to purge the whole cache or purge a single url.

To purge the whole cache you can use:

`drush @docker cf-purge:purge-all`

The purge a url:

`drush @docker cf-purge:purge-url [url]`

Where:

* url is single URL.

e.g. the following drush command purges a URL from the Cloudflare cache.

`drush @docker cf-purge:purge-url http://www.example.tld`