Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purge url programmatically #53

Open
ClaudiuCreanga opened this issue May 12, 2016 · 2 comments
Open

purge url programmatically #53

ClaudiuCreanga opened this issue May 12, 2016 · 2 comments

Comments

@ClaudiuCreanga
Copy link

ClaudiuCreanga commented May 12, 2016

Is there a way to purge the url programatically?

I'm updating the stock by writing to the database directly and would like to purge product urls (or by product id) afterwards (not on product save).

Or, if not, how would you go about purging all varnish programatically? (Mage::app()->cleanCache()) doesn't work.

Thanks!

@ClaudiuCreanga
Copy link
Author

So this would work for individual links: Mage::getModel('varnishcache/control')
->clean($host, sprintf('^%s$', $uri));

@Emulator000
Copy link

Emulator000 commented May 17, 2016

You can purge URL programmatically with this simple code snippet:
$cache = Mage::getSingleton('varnishcache/control');
if ($cache)
{
$cache->clean($_SERVER['HTTP_HOST'], 'URL/HERE');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants