I am building an application which uses Flashdata to display messages to the user after certain actions – e.g. “Item Successfully Removed”, etc. I am also using CodeIgniter’s Database Query Caching in order cache certain queries until I invalidate them.
After editing an item, I set a Flashdata message to say “Item Edited”. I then redirect() to the All Items view – which displays the Flashdata message. However, this Flashdata message persists even when I reload the page. The only way to get it to disappear is by emptying out the application/cache directory.
Is there any sensible way of overriding the Caching mechanism to not cache Flashdata? I have found this – http://codeigniter.com/wiki/No_Flash_Cache – but it seems to be a very old solution for CI 1.7. I gave it a go anyway but for some reason CI didn’t want to override the private function _write_cache() – it would override everything else just fine though… (Edit: realised now that (unless someone tells me otherwise) that only affects Output caching – not Database caching)
Thanks in advance!
You can change the cache mechanism of codeigniter by using cache_override hook. Following lines have been copied from their documentation