Background

I have scenario where I have 15000+ rows of messags in Mysql, I
present them with pagination. It works well till 10 pages, if the user
suddenly press the last page, Mysql takes lot of time, I figured out
that it is due to my shared hosting server is under heavy load.
Either I do something or host is somewhere else. I want to take the
challenge.

Since I provide just pagination, no sorting based on other columns,
after 2-3 pages, the page will always display the same set of
messages, I am thinking of caching them and serve it instead of
hitting the database.

I am planning to run a process which will select the rows from the
table pagewise (15 messages) and create static cache element and keep
it ready instead of creating on demand (I can run at night when the
load is low, instead of creating on demand on day time when the server
load is high).

How can I create more than one cachable elements from controller. ?

The code might look like this, need to create elements like
elements_project1_index_00001_000015, etc.,

controller

   function create_static_pages() {
        for ($i = 1 ; $i <= $pages - $this->index_threshold; $i++) {

        $messages = $this->Post->findAll(null, null, "posted_on ASC",
$this->page_size, $i, null);
        $view->element('index-page',  array('cache' => '+365 days',
                                 'plugin' => $this->group_name."_"
                                 
.$messages[0]['Post']['id']."_".$messages[count($messages) -
1]['Post']['id']));
                }
   }

How can I force creating all cacheable elements in tmp/cache/views ?
The above $view->element doesn't seem to work.

MySQL database is already disabled due to have load, I have to make
this work in 2-3 days.

Please advise.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to