I currently run nginx with Varnish in front on my Magento instance. I use Turpentine as the Varnish module for Magento. Without clearing the entire Varnish cache, is it possible just to flush the homepage cache?
-
3This question appears to be off-topic because it is about how to clear varnish and not about magento– Fabian BlechschmidtCommented Feb 25, 2014 at 23:37
-
1@FabianBlechschmidt for me this is a valid question as the Turpentine extension is sending the flush commands to Varnish.– Matthias ZeisCommented Feb 26, 2014 at 5:42
-
ask the support contact of the module for this feature.– FlyingmanaCommented Feb 26, 2014 at 9:27
Add a comment
|
2 Answers
Not through Turpentine, but you can run this command (as root/sudo) to flush just the homepage (may need to adjust if Magento is not installed at the top level of your site):
varnishadm ban.url '^/(?:index\.php/?)?$'
There is no page in the module by default. Though, you could create your own page in the admin with a form to submit an URL.
Within the controller you only need a few lines of code to actually ban a URL from the Varnish cache.
$sockets = Mage::helper( 'turpentine/varnish' )->getSockets();
foreach($sockets as $socket) {
$socket->ban( 'req.http.host', '==', '{host_name}', '&&', 'req.url', '==', '{path}');
}