src/services/HtmlcacheService.php
public function clearCacheFile($elementId)
    {
        // get all possible caches
        $elements = HtmlCacheElement::findAll(['elementId' => $elementId]);
        // \craft::Dd($elements);
        $cacheIds = array_map(function ($el) {
            return $el->cacheId;
        }, $elements);

        // get all possible caches
        $caches = HtmlCacheCache::findAll(['id' => $cacheIds]);
        foreach ($caches as $cache) {
            $file = $this->getCacheFileName($cache->uid);
            if (file_exists($file)) {
                @unlink($file);
            }
        }


        // delete caches for related entry
        HtmlCacheCache::deleteAll(['id' => $cacheIds]);
        return true;
    }
public function clearCacheFile($elementId)
    {
        // get all possible caches
        $elements = HtmlCacheElement::findAll(['elementId' => $elementId]);
        // \craft::Dd($elements);
        $cacheIds = array_map(function ($el) {
            return $el->cacheId;
        }, $elements);

        // get all possible caches
        $caches = HtmlCacheCache::findAll(['id' => $cacheIds]);
        foreach ($caches as $cache) {
            $file = $this->getCacheFileName($cache->uid);
            if (file_exists($file)) {
                @unlink($file);
            }
        }


        // delete caches for related entry
        HtmlCacheCache::deleteAll(['id' => $cacheIds]);
        return true;
    }
public function clearCacheFile ( $ elementId ) { // get all possible caches
 $ elements = HtmlCacheElement :: findAll ( [ 'elementId' => $ elementId ] ) ; // \craft::Dd($elements);
 $ cacheIds = array_map ( function ( $ el ) { return $ el -> cacheId ; } , $ elements ) ; // get all possible caches
 $ caches = HtmlCacheCache :: findAll ( [ 'id' => $ cacheIds ] ) ; foreach ( $ caches as $ cache ) { $ file = $ this -> getCacheFileName ( $ cache -> uid ) ; if ( file_exists ( $ file ) ) { @ unlink ( $ file ) ; } } // delete caches for related entry
 HtmlCacheCache :: deleteAll ( [ 'id' => $ cacheIds ] ) ; return true ; }
clear cache for given elementId

@param integer $elementId
@return boolean
clear cache for given elementId