• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Close connection

#1
Hi
Is it important for close connection after query?
Example
$res = $this->db->query('')->result_array();
$this->db->close();

Also i have other question
How do i can delete cache only for special query?
at the moment we can delete all cache
Reply

#2
(08-17-2018, 05:07 AM)omid_student Wrote: Hi
Is it important for close connection after query?
Example
$res = $this->db->query('')->result_array();
$this->db->close();

Also i have other question
How do i can delete cache only for special query?
at the moment we can delete all cache

AFAIK, Query builder automatically close the database after use (correct me if I'm wrong)

For special queries, assign your special query to a variable:
PHP Code:
$special_query $this->db->query(); 

Then if you want to use 
PHP Code:
$this->db->flush_cache(); 

You can still use your special query:
PHP Code:
$special_query->result(); 

But I didn't try this before (but I use query caching a lot), so try it for yourself.
Reply

#3
(08-17-2018, 05:19 AM)XtreemDeveloper Wrote: You can use this line after your query

$this->output->delete_cache('path');
Can i use output cache for database?
But my cache is for database
For each query,codeigniter save file in special folder
Actually in segment country/list folder save all caches file
And i need delete special file
Example
$this->db->query('select * from data where id = 1'); => file name is 12asf1af124123123123
$this->db->query('select * from data where id = 2'); => file name is 12asf1afsdfsdfdsf323123

I need delete 12asf1afsdfsdfdsf323123 file not all files in folder
Reply

#4
(08-17-2018, 05:19 AM)XtreemDeveloper Wrote: You can use this line after your query

$this->output->delete_cache('path');

Dude, your reply is completely irrelevant to the question. 

That's for output, not for queries. You're just spamming your website.
Reply

#5
(08-17-2018, 05:28 AM)kaitenz Wrote:
(08-17-2018, 05:19 AM)XtreemDeveloper Wrote: You can use this line after your query

$this->output->delete_cache('path');

Dude, your reply is completely irrelevant to the question. 

That's for output, not for queries. You're just spamming your website.

Sorry i was be confused
My big problem is cache query
Reply

#6
(08-17-2018, 05:30 AM)omid_student Wrote:
(08-17-2018, 05:28 AM)kaitenz Wrote:
(08-17-2018, 05:19 AM)XtreemDeveloper Wrote: You can use this line after your query

$this->output->delete_cache('path');

Dude, your reply is completely irrelevant to the question. 

That's for output, not for queries. You're just spamming your website.

Sorry i was be confused
My big problem is cache query

No, that comment is not for you. It's for XtreemDeveloper.

Have you tried my answer? Hope it helps you.
Reply

#7
(08-17-2018, 05:32 AM)kaitenz Wrote:
(08-17-2018, 05:30 AM)omid_student Wrote:
(08-17-2018, 05:28 AM)kaitenz Wrote:
(08-17-2018, 05:19 AM)XtreemDeveloper Wrote: You can use this line after your query

$this->output->delete_cache('path');

Dude, your reply is completely irrelevant to the question. 

That's for output, not for queries. You're just spamming your website.

Sorry i was be confused
My big problem is cache query

No, that comment is not for you. It's for XtreemDeveloper.

Have you tried my answer? Hope it helps you.

Thank you
Yes i tried it but it is looklike database caching
It means that output cache delete all files in folder no special file
Actually i want to remove special file
Please let me more explain :
I have many hotels that user search it for each hotel
And i cache their ,example cache query for hotel id with 1 or 2 or 3
Now maybe i change hotel name with id 3
So i force codeigniter to remove cache for hotel id 3 file not all files
Maybe?
Reply

#8
If you autoload any of the libraries they are left loaded,
they only close if you load them in a method call.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#9
(08-17-2018, 11:24 AM)InsiteFX Wrote: If you autoload any of the libraries they are left loaded,
they only close if you load them in a method call.

yes it is autoload
Thanks about it
And what is your suggest for delete special record cache (Database)?
Reply

#10
You would need to keep track of your query caches maybe in an array etc;

Then you could just grab it from your array etc; Then delete that special one.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.