Page 1 of 2

Caching and menus

Posted: Wed Nov 16, 2005 9:15 pm
by fadum
Hi can you explain why the menu system is not cached with the rest of the page, this causes a huge load on a large cms and i cant understand why its that way.?

Also has anyone got any tuning tips for cmsms as it seems very resource hungry

Im not complaining, i love the cmsms and appreciate all the hard work thats put into it, its just a couple of things that would make it perfect

Thanks

Re: Caching and menus

Posted: Wed Nov 16, 2005 10:01 pm
by megabob3
fadum wrote: Hi can you explain why the menu system is not cached with the rest of the page, this causes a huge load on a large cms and i cant understand why its that way.?

Also has anyone got any tuning tips for cmsms as it seems very resource hungry

Im not complaining, i love the cmsms and appreciate all the hard work thats put into it, its just a couple of things that would make it perfect

Thanks
I thinked alot of time to do something like that.

It's a nice request.

Re: Caching and menus

Posted: Thu Nov 17, 2005 1:04 am
by Ted
Yes, it's been running through my head as well that we need this.  i have a few ideas, but I'm afraid to make any more major changes before 0.11/1.0.

I actually like the pimenu idea of sorts, though some wrappers and a better caching mechanism would have to be put into place, but it's going in the right direction.

Re: Caching and menus

Posted: Thu Nov 17, 2005 1:10 am
by fadum
In the mean time i have added my own caching on the index.php that just checks the last modified date and creates a cache of the page by storing it and calling it if the modified date is before the create date, simple and very effective, VERY fast pages 1 query loaded in 0.002secs

Can you answer why the menu isnt cached? when the rest of the content is.

Thanks

Re: Caching and menus

Posted: Thu Nov 17, 2005 1:14 am
by Ted
Honest answer?  I never thought of it.  As soon as I saw the idea, I kind of smacked myself on the head and wondered what I was thinking.

Can you pass that code along?  I'm curious to see what you did.

Re: Caching and menus

Posted: Thu Nov 17, 2005 1:28 am
by fadum
Here we go, its VERY rough as i was just trying it out.

Code: Select all

// Top after copyright info

$pagee = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page 
$cacheext = 'html'; 
$cachedir = "/path/path/public_html/my/cache/";

$chkdt = str_replace("/","",str_replace(".html","",$_SERVER['REQUEST_URI']));

$query = "SELECT modified_date as mody FROM cms_content where content_alias='$chkdt'";
$result = mysql_query($query) or die("Error: " . mysql_error()); 
$row=mysql_fetch_assoc($result);
$mody = $row["mody"];

$modunix=strtotime("$mody");

$ignore_list = array( 
'mysite.com/rss.php', 
'mysite.com/search/' 
); 

require_once("lib/misc.functions.php");

$cachetime = 120000; // Seconds to cache files for just a safeguard
$cachefile = $cachedir . md5($pagee) . '.' . $cacheext; // Cache file to either load or create 


$ignore_page = false; 
for ($i = 0; $i < count($ignore_list); $i++) { 
$ignore_page = (strpos($page, $ignore_list[$i])!== false)? true : $ignore_page; 
} 


$cachefile_created = ((@file_exists($cachefile)) and ($ignore_page === false))? @filemtime($cachefile) : 0; 
@clearstatcache(); 

if ($modunix < $cachefile_created) { 

@readfile($cachefile); 

$endtime = microtime();

exit(); 

} 

// no cache or old cache so we are still here so heres the original php stuff


blah blah


// Near bottom of page
// Now the script has run, generate a new cache

$fp = @fopen($cachefile, 'w'); 

@fwrite($fp, ob_get_contents()); 
@fclose($fp); 

ob_end_flush(); 

Re: Caching and menus

Posted: Thu Nov 17, 2005 10:44 am
by Piratos
Use pimenu - you can create your own menus via smarty and yoou can make ist static or dynamic.

5000  !!! Pages - Menu

Generated in 0.443242 seconds by CMS Made Simple 0.11-beta4 (cached) using 9 SQL queries

== 0.0000886484 seconds  one page.

Re: Caching and menus

Posted: Thu Nov 17, 2005 10:52 am
by fadum
Is this pimenu the same as ellnav? as i have that implemented

Re: Caching and menus

Posted: Thu Nov 17, 2005 11:30 am
by Piratos
No pimenu is not ellnav.

pimenu is a small plugin that delivers all datas from the cms and some logical datas that you need to build a menu with smarty.

you can compose ellnav with pimenu  - you must only write a template.

you can use nearly all menusystems there are on the market - if you compose a smarty - template.

Re: Caching and menus

Posted: Thu Nov 17, 2005 11:37 am
by fadum
Cheers, ill take a look

Re: Caching and menus

Posted: Thu Nov 17, 2005 2:19 pm
by Piratos
plugin in the plugin folder

templates in the tmp/templates_c folder

all cms standard.

Re: Caching and menus

Posted: Thu Nov 17, 2005 2:32 pm
by lemkepf
wishy wrote: Yes, it's been running through my head as well that we need this.  i have a few ideas, but I'm afraid to make any more major changes before 0.11/1.0.

I actually like the pimenu idea of sorts, though some wrappers and a better caching mechanism would have to be put into place, but it's going in the right direction.
Maybe a .2 speed release would be in order? I noticed the lag on my fully implemented site today. None of my 56k users will notice it, but i notice it on my broadband. I think the sign of a good product includes the tuning aspect. (btw... i'll help if i can)
Thoughts?

Re: Caching and menus

Posted: Thu Nov 17, 2005 4:54 pm
by Piratos
Maybe a .2 speed release would be in order?
Version 3 should be the speed version you mean - it is now beta.

Re: Caching and menus

Posted: Thu Nov 17, 2005 5:39 pm
by fadum
Piratos wrote:
Maybe a .2 speed release would be in order?
Version 3 should be the speed version you mean - it is now beta.
where is 3?

Re: Caching and menus

Posted: Thu Nov 17, 2005 5:42 pm
by lemkepf
Piratos wrote:
Maybe a .2 speed release would be in order?
Version 3 should be the speed version you mean - it is now beta.
I'm talking about the CMSMs CORE, not the PIMENU. Sorry for the confusion.