Question about CMS made simple's cache

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
NickR

Question about CMS made simple's cache

Post by NickR »

Hi,

At what level(s) does the cache work, is it query caching, page or output caching ?

If it uses query caching can I disable it ?

Thanks, Nick
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Question about CMS made simple's cache

Post by Ted »

It's using smarty for caching.  Basically, it keeps a cached version of the compiled smarty template in tmp/templates_c and only goes out to the database to get another version of the template(s) if they're timestamps are older than the ones in the database.

(The word template in smarty is different from CMSMS's usage.  It's meaning any chunk of text that smarty needs to process.  A content block, global content block, template or any templates used by a module fall into this category.)
NickR

Re: Question about CMS made simple's cache

Post by NickR »

Ted wrote: It's using smarty for caching.  Basically, it keeps a cached version of the compiled smarty template in tmp/templates_c and only goes out to the database to get another version of the template(s) if they're timestamps are older than the ones in the database.

(The word template in smarty is different from CMSMS's usage.  It's meaning any chunk of text that smarty needs to process.  A content block, global content block, template or any templates used by a module fall into this category.)
So that means any content output from any module can be cached by smarty as well ?

Nick.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Question about CMS made simple's cache

Post by Ted »

Templates cache, but the actual content shouldn't.  In the case of modules, that would mean that anything like {$title} should be created everytime.  It's just that the compiled template would have an echo $title; instead of {$ititle} in it. 

Does that make any sense? (it's still early here.  :) )
NickR

Re: Question about CMS made simple's cache

Post by NickR »

Ted wrote: Templates cache, but the actual content shouldn't.  In the case of modules, that would mean that anything like {$title} should be created everytime.  It's just that the compiled template would have an echo $title; instead of {$ititle} in it. 

Does that make any sense? (it's still early here.  :) )
Why do you say content shouldn't (cache)?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Question about CMS made simple's cache

Post by Ted »

If module output cached, there would be no way for the smarty to know the content updated just by looking at templates.  You could then have it cache the output based on rules from the module knowing when content has changed or whatever, but it just makes it too difficult to code a simple module.

We do our best job to mix caching, dynamicism (probably not a real word) and ease of development.

And to be honest, real caching of the output doesn't speed it up that much (we've tried it).  Including files is slower than easy sql queries... at least in php.

The only way to get it REALLY fast is to output static html and skip the php stuff all together.  But then you really lose your dynamic abilities.
NickR

Re: Question about CMS made simple's cache

Post by NickR »

Ted wrote: If module output cached, there would be no way for the smarty to know the content updated just by looking at templates.  You could then have it cache the output based on rules from the module knowing when content has changed or whatever, but it just makes it too difficult to code a simple module.

We do our best job to mix caching, dynamicism (probably not a real word) and ease of development.

And to be honest, real caching of the output doesn't speed it up that much (we've tried it).  Including files is slower than easy sql queries... at least in php.

The only way to get it REALLY fast is to output static html and skip the php stuff all together.  But then you really lose your dynamic abilities.

Cheers, makes sense.

Could be possible to write a helper function that can take the querystrings from a module and write them as properties/params into the templates tags - this helper function could be called as part of the functionality that loads a module... but I dont even know if smarty has the ability to differentiate in this way - ideally we would want it to only store the blocks of output that vary, not the whole pages !

I think the best approach for general performance is good php and good queries - output caching should only be used to survive a slashdot.

Cheers Nick
Last edited by NickR on Tue Jun 20, 2006 12:34 pm, edited 1 time in total.
Maarten
Forum Members
Forum Members
Posts: 84
Joined: Sat May 06, 2006 9:52 am

Re: Question about CMS made simple's cache

Post by Maarten »

Ted wrote: If module output cached, there would be no way for the smarty to know the content updated just by looking at templates.  You could then have it cache the output based on rules from the module knowing when content has changed or whatever, but it just makes it too difficult to code a simple module.

We do our best job to mix caching, dynamicism (probably not a real word) and ease of development.

And to be honest, real caching of the output doesn't speed it up that much (we've tried it).  Including files is slower than easy sql queries... at least in php.

The only way to get it REALLY fast is to output static html and skip the php stuff all together.  But then you really lose your dynamic abilities.
But just thinking out loud. Isn't it an idea to render a HTML page after each safe. For example you edit some content and when the user press  save the system creates a static page which can be loaded until a new edit has been made. offcourse some element like time can be a problem.
NickR

Re: Question about CMS made simple's cache

Post by NickR »

Ted,

Just one more thing, release 0.13 has smarty caching turned off, is this the same caching as mentioned above or something different ?

Cheers Nick
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Question about CMS made simple's cache

Post by Ted »

It's actually something different.  Smarty then has this extra ability to cache the actual html ouput of the templates.  However, it's just an extra step that really doesn't gain us much, given the nature of the system.  Because everything that's inside a {} doesn't technically cache (at least in smarty's way to seeing it), the tempaltes and the cached output would basically be exactly the same....just with more disk I/O time.
NickR

Re: Question about CMS made simple's cache

Post by NickR »

Ted wrote: It's actually something different.  Smarty then has this extra ability to cache the actual html ouput of the templates.  However, it's just an extra step that really doesn't gain us much, given the nature of the system.  Because everything that's inside a {} doesn't technically cache (at least in smarty's way to seeing it), the tempaltes and the cached output would basically be exactly the same....just with more disk I/O time.
Cheers, if the code is well written output caching will only gain you a little page load time - very little if you use eaccelerator as well.
philight

Re: Question about CMS made simple's cache

Post by philight »

Maarten wrote: Isn't it an idea to render a HTML page after each safe. For example you edit some content and when the user press  save the system creates a static page which can be loaded until a new edit has been made. offcourse some element like time can be a problem.
That's exactly the function i'am looking for because of a poor hosting and i'm close to have a nervous breakdown... online.net a french service very bad with CMSMS and very bad by the way!!

Did someone experience a solution to output static html and make update each time pages are edited?

Philight
Locked

Return to “CMSMS Core”