# searchpro/4.1.13/inc/thirdparty/hosting/Pagely.php

BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS &amp; JavaScript, version 4.1.13. 32 lines.

- Page: https://pluginprobe.com/plugins/searchpro/4.1.13/code/inc/thirdparty/hosting/Pagely.php
- Raw: https://pluginprobe.com/plugins/searchpro/4.1.13/raw/inc/thirdparty/hosting/Pagely.php
- Modified: 2024-08-20T18:00:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/searchpro/4.1.13/code/inc/thirdparty/hosting/Pagely.php#L10-L20`.

```php
<?php 
if (!defined('ABSPATH')) exit;

class Pagely extends berqIntegrations {
    function __construct() {
        add_action('berqwp_stored_page_cache', [$this, 'flush_page_cache']);
        add_action('berqwp_flush_page_cache', [$this, 'flush_page_cache']);
        add_action('berqwp_flush_all_cache', [$this, 'flush_all_cache']);
    }

    function flush_all_cache() {
        if (class_exists('PagelyCachePurge')) {
            $purger = new PagelyCachePurge();
            $purger->purgeAll();
        }
    }

    function flush_page_cache($slug) {

        if (empty($slug)) {
            $slug = '/';
        }

        if (class_exists('PagelyCachePurge')) {
            $purger = new PagelyCachePurge();
            $purger->purgePath($slug);
        }
    }

}

new Pagely();
```
