Welcome Guest, Not a member yet? Register   Sign In
Too much delay
#1

Hi;

I have a library where it sets flash data like this but for some reason it takes such a long time. This takes about 3 seconds!

PHP Code:
$CI->session->set_flashdata('no_group_cards'$CI->model_auth->no_group_cards($CI->session->userdata['logged_data']['member_id'])); 

The query is nice and optimized: EXPLAIN.

What could it be?

Thanks
Reply
#2

Code:
$CI->session->userdata['logged_data']['member_id']

As far as I know userdata is a method, a getter.
Reply
#3

ivantcholakov is correct, $CI->session->userdata is a method not an array.
"I reject your reality and substitute my own" - Adam Savage, M5 Inc.
Reply
#4

(01-15-2015, 05:37 AM)Hobbes Wrote: ivantcholakov is correct, $CI->session->userdata is a method not an array.
Hi;
Not sure what I am missing :p
This part retrieves data from DB ( and later stores them in the session ):
PHP Code:
model_auth->no_group_cards($CI->session->userdata['logged_data']['member_id']) 
Reply
#5

(This post was last modified: 01-22-2015, 02:04 AM by Avenirer.)

Is just what Ivan and Hobbes said: $CI->session->userdata() is a method. And you think that userdata is an array.

I suppose that you should so something like this:
PHP Code:
$logged_data $CI->session->userdata('logged_data');
$CI->session->set_flashdata('no_group_cards'$CI->model_auth->no_group_cards($logged_data['member_id']));  
Reply
#6

The userdata() method ... fetches data from the $userdata property, it's not only a method.
Reply
#7

Its most likely that
PHP Code:
$CI->model_auth->no_group_cards 
this method is taking your time ..

Make a count as:
PHP Code:
$start=microtime(TRUE);
$id $CI->session->userdata['logged_data']['member_id'];
echo 
microtime(TRUE) - $start ' first time with id = '.$id.' <br> ';
$data $CI->model_auth->no_group_cards($id);
echo 
microtime(TRUE) - $start ' second time <br> '

Once you get the timing you will know if the problem is in the auth method and perhaps you may need to add some index (user_id ) or on the field you are using for your Select.
Best VPS Hosting : Digital Ocean
Reply
#8

(01-22-2015, 03:04 AM)sv3tli0 Wrote: Its most likely that


PHP Code:
$CI->model_auth->no_group_cards 
this method is taking your time ..

Make a count as:


PHP Code:
$start=microtime(TRUE);
$id $CI->session->userdata['logged_data']['member_id'];
echo 
microtime(TRUE) - $start ' first time with id = '.$id.' <br> ';
$data $CI->model_auth->no_group_cards($id);
echo 
microtime(TRUE) - $start ' second time <br> '

Once you get the timing you will know if the problem is in the auth method and perhaps you may need to add some index (user_id ) or on the field you are using for your Select.

Hey;

Nah that's not it. That query works and takes fraction of a second. I use these methods all around the app.

But the session created is HUGE.
Reply
#9

(This post was last modified: 01-22-2015, 05:14 PM by CroNiX.)

Please check the user guide for the session library, and look at how they show how to retrieve session data, and how you are using it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB