update/clear cache

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
edented
Forum Members
Forum Members
Posts: 23
Joined: Sat Aug 29, 2009 4:24 am

update/clear cache

Post 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...
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: update/clear cache

Post 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
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
edented
Forum Members
Forum Members
Posts: 23
Joined: Sat Aug 29, 2009 4:24 am

Re: update/clear cache

Post 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
Post Reply

Return to “Developers Discussion”