CodeIgniter Forums
Delete only special db cache - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Delete only special db cache (/thread-70636.html)

Pages: 1 2


Delete only special db cache - omid_student - 05-06-2018

Hi
I use $this->db->cache_on() and it is working well
I cache for each query
But when i try to delete cache,it delete all cache for current segment
Example for /index.php/api/users
I need delete query "Select * from tbl where id = 1" only no all query in segment api/users
Is it possible? or use output->cache for cache?


RE: Delete only special db cache - omid_student - 05-06-2018

Who is helping me?


RE: Delete only special db cache - jreklund - 05-07-2018

(05-06-2018, 11:49 PM)omid_student Wrote: Who is helping me?

No one with that attitude... there are 36 views, but apparently no one knows the answer. You wan't everyone to type "I don't know"?


RE: Delete only special db cache - omid_student - 05-07-2018

(05-07-2018, 12:42 AM)jreklund Wrote:
(05-06-2018, 11:49 PM)omid_student Wrote: Who is helping me?

No one with that attitude... there are 36 views, but apparently no one knows the answer. You wan't everyone to type "I don't know"?

Thanks


RE: Delete only special db cache - InsiteFX - 05-07-2018

From what I read each query is placed in a file and sub-directories.

Read this part.

Database Caching Class


RE: Delete only special db cache - omid_student - 05-07-2018

(05-07-2018, 03:57 AM)InsiteFX Wrote: From what I read each query is placed in a file and sub-directories.

Read this part.

Database Caching Class

Yes i know but codeigniter cache each query in single directory and i have to remove all cache for a special query


RE: Delete only special db cache - BobM - 05-07-2018

(05-06-2018, 09:13 AM)omid_student Wrote: Hi
I use $this->db->cache_on() and it is working well
I cache for each query
But when i try to delete cache,it delete all cache for current segment
Example for /index.php/api/users
I need delete query "Select * from tbl where id = 1" only no all query in segment api/users
Is it possible? or use output->cache for cache?

$this->cache->delete('NAME OF YOUR CACHE');


RE: Delete only special db cache - omid_student - 05-07-2018

(05-07-2018, 08:35 AM)BobM Wrote:
(05-06-2018, 09:13 AM)omid_student Wrote: Hi
I use $this->db->cache_on() and it is working well
I cache for each query
But when i try to delete cache,it delete all cache for current segment
Example for /index.php/api/users
I need delete query "Select * from tbl where id = 1" only no all query in segment api/users
Is it possible? or use output->cache for cache?

$this->cache->delete('NAME OF YOUR CACHE');
Yes i know but it delete directory according of segment uri,isn't it?


RE: Delete only special db cache - omid_student - 05-08-2018

I finally found solution
I try get query of cache that already i save it and md5 it and delete from folder
Example when i cache query "SELECT * FROM users WHERE ID = 1" ,codeigniter make file with b0ef4c88552b8d0d00d22b5425c92aef name in current segment
So i make again same query and md5 it and delete file and recache query
How is my solution?


RE: Delete only special db cache - InsiteFX - 05-08-2018

If it works for you leave it alone.