Skip to main content
🎁 Exclusive Launch Deal: Premium Themes Available FREE — Grab Yours Now!
Back to Blog
General

Magneto Tutorial - Clear Full Page Cache via Cron

admin 1 min readPublished Jun 18, 2022Updated Jul 3, 2026
Magneto Tutorial - Clear Full Page Cache via Cron

Hey Friends

In Today's tutorial we are showing How you can clear your magento's Full Page Cache using cron

First of all create a Module as below

app/code/NameSpace/FpcRefreshCache

create a file registration.php

 

Create a module.xml under app/code/NameSpace/FpcRefreshCache/etc folder



    

Create File NameSpace/FpcRefreshCache/Cron/ClearCache.php

eventManager = $eventManager;
$this->logger = $logger;
$this->cacheManager = $cacheManager;
}
/**
     *  Clear the cache on a time interval to Fix the add to cart issue
     */
public function execute()
{
 $this->eventManager->dispatch('adminhtml_cache_flush_all');
$this->cacheManager->clean([PageCacheType::TYPE_IDENTIFIER]);
  $this->logger->info('Cache Cleaned - '.PageCacheType::TYPE_IDENTIFIER);
  }
}//end class

Create a file crontab.xml

 
 0 */4 * * *
  

Hope You like our this solution! Please vist again.

[mc4wp_form id="194"]