Close connection |
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 (08-17-2018, 04:07 AM)omid_student Wrote: Hi 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.
(08-17-2018, 04:19 AM)XtreemDeveloper Wrote: You can use this line after your queryCan 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
(08-17-2018, 04:28 AM)kaitenz Wrote:(08-17-2018, 04:19 AM)XtreemDeveloper Wrote: You can use this line after your query Sorry i was be confused My big problem is cache query (08-17-2018, 04:30 AM)omid_student Wrote:(08-17-2018, 04:28 AM)kaitenz Wrote:(08-17-2018, 04:19 AM)XtreemDeveloper Wrote: You can use this line after your query No, that comment is not for you. It's for XtreemDeveloper. Have you tried my answer? Hope it helps you.
(08-17-2018, 04:32 AM)kaitenz Wrote:(08-17-2018, 04:30 AM)omid_student Wrote:(08-17-2018, 04:28 AM)kaitenz Wrote:(08-17-2018, 04:19 AM)XtreemDeveloper Wrote: You can use this line after your query 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?
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 )
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 )
|
Welcome Guest, Not a member yet? Register Sign In |