Deleting Application Cache in Code Igniter with PHP


The Code Igniter documentation says:

Deleting Caches

If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. Note: Removing the tag will not delete the cache immediately. It will have to expire normally. If you need to remove it earlier you will need to manually delete it from your cache folder.

The CI_Output class ($this->output->cache(30)) doesn’t provide any public delete_cache() method. To delete database cache, you can use Code Igniter’s built in methods like $this->db->cache_delete_all(). For application cache, you need to write the code yourself.

Why would you want to?

There’re several use cases. For example, if a non-coder has just made a content update to your site via a CMS and you want to make sure it shows up immediately and not after the remaining amount of time specified via $this->output->cache(YOUR_TIME_INTERVAL).

Code snippet

View original post 107 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s