Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Building Your Website With Cached Dynamic Modules
Now, the final html returned to the user is:

<title>Hello world</title>
<!-- my-style cached output (14:32) --//>
<font face=Arial size=2 color=yellow>
<!-- my-style end of output --//>
Hello world
You can endlessly expand on this model, adding modules is easy, as each module only has to conform to the calling convention my_modulename ($options) and return some html that can be replaced instead of the original call in the .my file.
Now, why would you do this? There are three important reasons:
  • caching
  • security
  • consistency
Caching
The parser optionally stores the output from the module in its cache directory. The next time someone calls <my-style name=test>, the parser checks if it can use the cached entry by checking on the expiration time of this particular entry. There is a default for all entries, but you can set it for each tag specifically by using the cache=x parameter:
<my-style name=test cache=3600>
Now if there is a cached entry, it will only be used if it is not older than one hour. After this hour, the module will be called again and the newly returned html will update the cache entry.
You will not want to use the cache for all tags, but for e.g. database driven modules or modules that use external webserver to retrieve information are likely to have a big performance penalty, so the caching might prove a big speedup here. Let alone when the underlying database or webserver is down, YOU then have a cached entry to serve!
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
Could somone please tell this!David Tandberg-Johansen10/05/02 08:50
building a websitepeter sims05/25/02 01:27
urm, try thisnobody01/28/01 02:08
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.