PHPBuilder - Another Look: Cached Dynamic Modules Page 2



RSS Twitter
Articles Site Operation

Another Look: Cached Dynamic Modules - Page 2

by: PHP Builder Staff
|
July 30, 2000

Manual Cache File Naming

I used a template to generate cache files on the fly, and this was based on dates and times. The cache's filename is generated on the value's being passed, but some filesystems do not allow colons that would be found in a time format. I realized I needed to allow the developer to name the cache file manually if desired.
<my-style name="time now" time="12:32:00" cache_name="onTheAir">
Originally, this tag would have produced a cache file with a name such as, 'style_name=time now_time=12:32:00'. Now, this module would produce a cache file with the simpler (valid) name: 'style_onTheAir'

'On The Hour' Cache Updating

JP's system allowed the developer to set the expires delay for a cache file. For example, if the expires delay was set to 3600 seconds, the cache file would be regenerated subsequent to the next hit after 3600 seconds have elapsed since the creation of the cache file.
My site needed to work a little differently. I needed the ability to automatically have the module refresh at specific intervals, such as, on the hour, or on the quarter-hour, or on the half-hour, etc. So I went ahead and added some functions to perform these evaluations and return whether the module was due to be updated or not.
<my-style name=test refresh='HALFHOUR'>
(this cache file updates itself every half-hour)
The available arguments for the refresh variable are:
MINUTE, QUARTERHOUR, HALFHOUR, HOUR, HALFDAY, DAY, MONTH

« Previous Page
1
|
2
|
3
|
4
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:

Comment:



Comment:

(Maximum characters: 1200). You have characters left.