Author Topic: Tip: Use the caching functionality of vlibTemplate  (Read 929 times)

0 Members and 1 Guest are viewing this topic.

releasedj

  • Guest
Tip: Use the caching functionality of vlibTemplate
on: Tue, 16. July 2002 - 11:11:00
Use the caching functionality of vlibTemplate.

All you have to do is change your class instantiation from vlibTemplate to vlibTemplateCache.

This will make your page scream along. You see, otherwise vlibTemplate has to parse the templates using regexs each time, which takes time, and the bigger your template, the longer it will take.
If you cache, you can cut down the time it takes to parse a template by hundreds of %.

Give it a try, youll never go back.

Kelvin
Last Edit: Sat, 17. February 2007 - 13:18:21 by ClausVB

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
Tip: Use the caching functionality of vlibTemplate
Reply #1 on: Sun, 13. October 2002 - 00:22:08
I always wanted to try that, but since my application is fast enough (blink of an eye) without caching I always put this task to my "next week" schedule.

Is it difficult to "rerun" the templates if they are cached?

Best regards,
Claus
Last Edit: Sat, 17. February 2007 - 13:18:35 by ClausVB

releasedj

  • Guest
Tip
Reply #2 on: Sun, 13. October 2002 - 10:21:14
vlibTemplateCache automatically detects changes in the template file, so if it changes, vlibTemplateCache will take a new copy of the template and put it into cache.

Really, the only changes you will notice is speed. Otherwise it's seemless.


Regards,

Kelvin

Stream

  • Guest
Tip
Reply #3 on: Sun, 13. October 2002 - 13:19:05
How does caching handle updated variables?

For example, if my template is supposed to show the last 10 articles, and a new article is written several times per hour...I will fetch the list of 10 last articles from the database and parse them into the template.

Will vlibTemplate automatically show the updated values from the database even if the caching is in use? Or do I need to recache the templates each time a update is done to the data I want to parse?

releasedj

  • Guest
Tip
Reply #4 on: Mon, 14. October 2002 - 09:32:08
vlibTemplateCache doesn't cache the actual content that you input from the PHP side, it just 'compiles' the template into native PHP code.

For more of an overview, take a look at this post:

/forum/index.php/topic,49