diff --git a/src/Filters/CachedContentFilter.php b/src/Filters/CachedContentFilter.php index 4d3b7ce..f8dce66 100644 --- a/src/Filters/CachedContentFilter.php +++ b/src/Filters/CachedContentFilter.php @@ -3,6 +3,8 @@ namespace SilverStripe\VersionFeed\Filters; use SilverStripe\Core\Config\Config; +use SilverStripe\Core\Injector\Injector; +use SilverStripe\Core\Kernel; /** * Caches results of a callback @@ -24,7 +26,7 @@ public function getContent($key, $callback) // Return cached value if available $cacheEnabled = Config::inst()->get(CachedContentFilter::class, 'cache_enabled'); - $result = (isset($_GET['flush']) || !$cacheEnabled) + $result = (Injector::inst()->get(Kernel::class)->isFlushed() || !$cacheEnabled) ? null : $cache->get($key); if ($result) { diff --git a/src/Filters/RateLimitFilter.php b/src/Filters/RateLimitFilter.php index e8ae7e7..12b2a1b 100644 --- a/src/Filters/RateLimitFilter.php +++ b/src/Filters/RateLimitFilter.php @@ -6,6 +6,8 @@ use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Versioned\Versioned; +use SilverStripe\Core\Injector\Injector; +use SilverStripe\Core\Kernel; /** * Provides rate limiting of execution of a callback @@ -85,7 +87,7 @@ public function getContent($key, $callback) { // Bypass rate limiting if flushing, or timeout isn't set $timeout = $this->config()->get('lock_timeout'); - if (isset($_GET['flush']) || !$timeout) { + if (Injector::inst()->get(Kernel::class)->isFlushed() || !$timeout) { return parent::getContent($key, $callback); }