1. Go to this page and download the library: Download mmikkel/cache-flag library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mmikkel / cache-flag example snippets
use mmikkel\cacheflag\CacheFlag;
// Invalidate all flagged caches
CacheFlag::getInstance()->cacheFlag->invalidateAllFlaggedCaches();
// Invalidate caches for a particular element
CacheFlag::getInstance()->cacheFlag->invalidateFlaggedCachesByElement($entry);
// Invalidate caches for one or several flags
CacheFlag::getInstance()->cacheFlag->invalidateFlaggedCachesByFlags(['news', 'images']);
use mmikkel\cacheflag\events\FlaggedTemplateCachesEvent;
use mmikkel\cacheflag\services\CacheFlagService;
use yii\base\Event;
Event::on(
CacheFlagService::class,
CacheFlagService::EVENT_BEFORE_INVALIDATE_FLAGGED_CACHES,
function (FlaggedTemplateCachesEvent $event) {
$flags = $event->flags;
...
}
);
Event::on(
CacheFlagService::class,
CacheFlagService::EVENT_AFTER_INVALIDATE_FLAGGED_CACHES,
function (FlaggedTemplateCachesEvent $event) {
$flags = $event->flags;
...
}
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.