ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Session posts many database updates on single page

December 08, 2012 3:49am

Subscribe [1]
  • #1 / Dec 08, 2012 3:49am

    Ki

    58 posts

    I am using HMVC framework with codeigniter when enabling profiler I have noticed that the code posts multiple updates to the DB (I am using sessions with db).

    All session updates start with:

    UPDATE `ci_sessions` SET `last_activity` = 1354954769

    Does someone know why or what can be causing this? Is it that each time I call session->set_userdata() it hits the database or soemthing to do with modules that I am calling?

  • #2 / Dec 08, 2012 3:56am

    Ki

    58 posts

    I figure id out almost as quickly as I posted the question.
    When creating

    $this->session->set_flashdata('messages1','TEST');
    $this->session->set_flashdata('messages2','TEST');
    $this->session->set_flashdata('messages3','TEST');

    I noticed it generated multiple calls to DB to update the session. Doe snot seem very efficient. Is there a way to combine the session data into one DB call at the end of execution.
    If my application wants to post multiple messages to the user, that are created throughout call execution, is there a way to merge all of them into one and update the session at the end?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases