Using Cache_Lite_Function inside a class
| From: | Faraday Cage | Date: | Fri, 06 Jun 2003 10:55:51 +0000 |
| Subject: | Using Cache_Lite_Function inside a class | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5845@lists.php.net to get a copy of this message | ||
I'm trying to use Cache_Lite_Function within a class to cache the output of a function.
Here's my example code:
require_once("Cache/Lite/Function.php");
class Foo {
var $cache;
function Foo() {
$options = array(
'cacheDir' => '/tmp/'
);
$this->cache = new Cache_Lite_Function($options);
}
function toBeCached() {
return "blah";
}
function getCached() {
return $this->cache->call('this->toBeCached');
}
}
$foo = new Foo();
echo $foo->getCached();
And I am getting this error:
Fatal error: Call to a member function on a non-object in
/usr/local/share/pear/Cache/Lite/Function.php on line 98
Can anyone help?
Thanks.
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger