Re: [SMARTY] RE: [Smarty] Deleting a specific cache id from a different smarty instance
| From: | M Mohr | Date: | Sat, 25 Jan 2003 20:45:51 +0000 |
| Subject: | Re: [SMARTY] RE: [Smarty] Deleting a specific cache id from a different smarty instance | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7335@lists.php.net to get a copy of this message | ||
On Sat, Jan 25, 2003 at 11:26:58AM -0700, Hoffman, Geoffrey wrote:
> Now I just realized that in my publication
> system, I'm going to need to trash
> all the summary-display section
> cache at 12:01 am on each day.
> Should I use CRON for that?
definitely :) use a smarty cli- or cgi-binary for that or fetch a url
of a php script that flushes the cache. you can use curl or wget for
that.
the simplest way would be of course to 'rm -r' the cache directory,
but then no file-locking against other php-script using the cache is
done and you may accidently delete a page in the (milli-)second another
process wants to display it.
HTH
messju
> GH> Just for the record, Thanks Messju,
> GH> your suggestion worked like a champ.
> GH>
> GH> It only took four lines of code:
> GH>
> GH> $id = $theOneToTrash;
> GH> require("../smarty_myapp.class.php");
> GH> $smtemp = new smarty_myapp();
> GH> $smtemp->clear_cache('index.tpl', $id);
>
>
> MM>> Maybe you could instanciate your $smarty_view_app
> MM>> inside your admin-pages and call
> MM>> $smarty_view_app->clear_cache().
> MM>> It is totally legal to have more than one
> MM>> instance of smarty in a php-script.
>
> GH>>> I'm wondering if there's an easy way to clear a
> GH>>> cache id at database update time instead of
> GH>>> display time.