I use the Registry for this. So in your bootstrap:
Zend_Registry::set('cache', Zend_Cache::factory( ... ));
then in your action or wherever:
Zend_Registry::get('cache')->save($var, 'var');
Zend_Registry::get('cache')->load('var')
Hope this helps!
On Tue, Aug 5, 2008 at 11:32 AM, temuri <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm trying to cache the entire class using Zend_Cache_Frontend_Class.
>
> My class instantiation code looks like (yes, $a and $b have to go into the
> constructor):
>
> $_myClass = new myClass($a, $b);
>
> After reading ZF manual, I came up with the following code:
>
> $frontendOptions = array(
> 'cached_entity' => new myClass($a, $b)
> );
> $backendOptions = array('cache_dir' => realpath("C:/tmp"));
> $cache = Zend_Cache::factory('Class', 'File', $frontendOptions,
> $backendOptions);
>
> Now, the problem is, how do I use this $cache to retrieve cached
> instantiated object?
>
> Of course, $cache->__construct($a, $b) fails (it also looks stupid - I
> already passed $a and $b in).
>
> What to do? Any ideas?
>
> Thanks,
> Temuri
> --
> View this message in context:
> http://www.nabble.com/Zend_Cache-with-%27Class%27-frontend---problem-with-__construct%28%24a%2C-%24b%29-tp18834887p18834887.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>