I have noticed that my site in Cakephp is very very slow. I have rewritten my entire site in Cakephp with exactly the same functionality and it’s taking 400 ms to generate every page instead of 20ms. 400ms is far away from the 50-100ms parsetimes I am hoping to archieve. Site speed is very important for me, it was one of the reasons I moved away from learning more about Drupal.
When writing all SQL queries myself and working with simple incudes, there was no need to do much optimizing. I have to start optimizing the code now though.
All pages show in a block the number of users, newsposts, articles and a few other things that have been posted. This takes 9 SQL queries and seems to take away some performance. That’s what I want to use caching for.
At the moment my site doesn’t get that many visitors and I’m mainly rebuilding it to become a better webdeveloper and the high parsetime bums me out. I am going to remove Croogo alltogether and only work with self-written code. I already stumbled on many horrible performance degrading parts of Croogo.
I would like to save all those 9 query results in cache once an hour via a cronjob. I want to run a cronjob with the 9 queries that saves the results in the cache. My question is how I can save data longer in cache? It normally saves data 10minutes, but I’d like to save this specific data for 150 minutes and run a cronjob every 2 hours. I know it can be done via core.php, but I wouldn’t like to cache everything for 150 minutes, just the statistics-data for the leftmost block at http://www.daweb.nl.
Statistieken
Artikelen:
Leden:
Javascripts: 29
Nieuwsberichten: 4
Nodes: 16
PHP Scripts:
Members, Articles, PHP Scripts are empty, which means nobody has accessed the pages that generate the relevant data. I could make a long block of code with a lot of if (there is cache) and else (generate cache), but that’s not going to make things much prettier either. Also, I’d have no idea where to place that code. I am not looking to write bunchload of code in app_controller.php, can’t be good for the site.
If site speed is important to you (more than those automagics Cake has to offer) then you might want to look at CodeIgniter.
Anyway, here’s how to set cache setting for elements: http://book.cakephp.org/view/1083/Caching-Elements