Welcome Guest, Not a member yet? Register   Sign In
Caching Functions
#8

[eluser]Sumon[/eluser]
[quote author="Flesha" date="1220997427"]Example:

I have a function to get hostname from the server and every pageview he performs the function.

This processe are slowly, then I wanted to cache this function and every 10, 20 minutes create a cache again.

Wink[/quote]

From CI User Guide

Since cache files do not expire, you'll need to build deletion routines into your application. For example, let's say you have a blog that allows user commenting. Whenever a new comment is submitted you'll want to delete the cache files associated with the controller function that serves up your comments. You'll find two delete functions described below that help you clear data.

Code:
$this->db->cache_delete()
Deletes the cache files associated with a particular page. This is useful if you need to clear caching after you update your database.
Code:
$this->db->cache_delete_all()
Clears all existing cache files.

Mirage,

You can’t cache a function. - Thanks for the information. I was sure but not confident enough as now i am.

So Finally, why not let the cache remain for a long period of time? You create a function of delete cache whenever new hostname added into the system. No need to create it every 10 or 20 minutes.


Messages In This Thread
Caching Functions - by El Forum - 09-08-2008, 10:32 AM
Caching Functions - by El Forum - 09-09-2008, 09:10 AM
Caching Functions - by El Forum - 09-09-2008, 09:38 AM
Caching Functions - by El Forum - 09-09-2008, 09:41 AM
Caching Functions - by El Forum - 09-09-2008, 10:49 AM
Caching Functions - by El Forum - 09-09-2008, 10:57 AM
Caching Functions - by El Forum - 09-09-2008, 11:14 AM
Caching Functions - by El Forum - 09-09-2008, 03:17 PM
Caching Functions - by El Forum - 09-09-2008, 08:30 PM
Caching Functions - by El Forum - 09-09-2008, 10:55 PM
Caching Functions - by El Forum - 09-10-2008, 09:01 AM
Caching Functions - by El Forum - 09-10-2008, 09:24 AM
Caching Functions - by El Forum - 09-10-2008, 09:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB