Caching and menus

General project discussion. NOT for help questions.
fadum

Caching and menus

Post 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
megabob3
Power Poster
Power Poster
Posts: 498
Joined: Sat Jan 08, 2005 11:11 pm

Re: Caching and menus

Post 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.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Caching and menus

Post 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.
fadum

Re: Caching and menus

Post 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
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Caching and menus

Post 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.
fadum

Re: Caching and menus

Post 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(); 
Piratos

Re: Caching and menus

Post 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.
fadum

Re: Caching and menus

Post by fadum »

Is this pimenu the same as ellnav? as i have that implemented
Piratos

Re: Caching and menus

Post 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.
fadum

Re: Caching and menus

Post by fadum »

Cheers, ill take a look
Piratos

Re: Caching and menus

Post by Piratos »

plugin in the plugin folder

templates in the tmp/templates_c folder

all cms standard.
lemkepf
Forum Members
Forum Members
Posts: 163
Joined: Tue Oct 18, 2005 8:30 pm

Re: Caching and menus

Post 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?
Piratos

Re: Caching and menus

Post by Piratos »

Maybe a .2 speed release would be in order?
Version 3 should be the speed version you mean - it is now beta.
fadum

Re: Caching and menus

Post 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?
lemkepf
Forum Members
Forum Members
Posts: 163
Joined: Tue Oct 18, 2005 8:30 pm

Re: Caching and menus

Post 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.
Post Reply

Return to “General Discussion”