Source of file DynamicCacheSecureAndFlushable.php
Size: 0,859 Bytes - Last Modified: 2021-12-23T10:39:30+00:00
/var/www/docs.ssmods.com/process/src/code/api/DynamicCacheSecureAndFlushable.php
123456789101112131415161718192021222324252627282930313233343536 | <?php class DynamicCacheSecureAndFlushable extends Extension implements Flushable { public function updateEnabled(&$enabled) { // Disable caching for this request if a user is logged in if (Member::currentUserID()) { $enabled = false; } // Disable caching for this request if in dev mode elseif (Director::isDev()) { $enabled = false; } // Disable caching if the request is in dev mode else { $session = Session::get_all(); if ($session && count($session)) { $enabled = false; } } } public function updateCacheKeyFragments(array &$fragments) { $fragments[] = Member::currentUserID(); } public static function flush() { DynamicCache::inst()->clear(); } } |