Page 1 of 1

update/clear cache

Posted: Wed Feb 10, 2010 3:21 am
by edented
Hi-
I've been updating data directly into the cms_content_props tables via an external script (to update content en mass).  When i view the site however, it doesn't display the fresh data unless i log in and manually clear the cache.

Is there a way to clear or update the cache from an external script?

I'm not sure this is where to post this, but i hope someone can steer me in the right direction...
Thanks for any insight...

Re: update/clear cache

Posted: Wed Feb 10, 2010 6:54 am
by Rolf
Hi edented,
Is there a way to clear or update the cache from an external script?
You can create an user defined tag, called f.i. clear_cache

Code: Select all

// Cut out of file: admin/siteprefs.php

{
	global $gCms;
	$contentops =& $gCms->GetContentOperations();
	$contentops->ClearCache();
	// $message .= lang('cachecleared');
}
In the Event Manager you can call this UDT and let it clear the cache automatically.

Hope this helps, Rolf

Re: update/clear cache

Posted: Wed Feb 10, 2010 8:25 am
by edented
Thanks for the quick response-  That helps a lot!

I see that i can make a page and include that UDT, then ping the url to clear the cache.  It's a bit of a workaround, but as long as the page isn't deleted or overwritten, it should be okay.

cheers
-e