Caching |
[eluser]Michael Nielsen[/eluser]
I'm currently using the CI cache class however when I update information in my database it takes 30 seconds to take visual affect. Is it possible to have the cache file re-written when I update my database so my users get to see their changes immediately?
[eluser]sophistry[/eluser]
you have to delete the cache file manually. http://ellislab.com/codeigniter/user-gui...ching.html
[eluser]Michael Nielsen[/eluser]
yes i know that but I want it do be done when the user updates their information, My question was is it possible?
[eluser]sophistry[/eluser]
there is no CI 'interface' for deleting cache files. that is why i said do it manually. this php function deletes files... Code: unlink();
[eluser]fesweb[/eluser]
And to find the correct file to delete, I believe you do something like this Code: $file_to_delete = md5($the_uri_of_the_page);
[eluser]minerbog[/eluser]
I have written a extension of the output class to do just this. Be aware that the cache system creates a md5 hash of the whole uri to use as a file name. This includes the 3rd 4th 5th etc segments, so i suggest anyone using this code uses it only with say test controller and some function like index.php/test/some. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); useage : $this->output->delete_page_cache('test/some'); Hope someone finds this useful. Gavin. |
Welcome Guest, Not a member yet? Register Sign In |