Hi guys, 

(Please forgive me if I've used the wrong mailing list.)

I was hoping someone can help me figure something out. I am trying to cache an 
object of simpleXml, obtained by parsing a third party stocks feed. It seems 
relatively straight-forward but for some reason I can save the result fine, but 
can't load it.

class IndexController extends BootstrapController
{
        private $frontendOptions = array(
                        'lifetime' => 500,
                        'automatic_serialization' => FALSE // Tried playing 
with TRUE/FALSE
                );
        private $backendOptions = array(
                        'cache_dir' => './cache/xml',
                        'file_name_prefix' => 'cache',
                );
        public function init()
        {
                parent::init();
        }
        public function indexAction()
        {
                $method = (string) "indexStocks";
                $cache = Zend_Cache::factory('Core', 'File', 
$this->frontendOptions, $this->backendOptions);  // Tried playing with options
                if(!$this->view->xmlFeed = $cache->load($method))
                {
                        $feed = simplexml_load_file('MY FEED'); // IP 
RESTRICTED FEED
                        $cache->save($feed, $method);
                        $this->view->xmlFeed = $feed;
                }
                $this->render();
        }
}

To be clear, everything works as expected if I omit the caching, so I am 
confident it is not a problem with the feed. I could cache the view, but I 
really don't want to do that.

Anyone have any thoughts?

-Ryan

Reply via email to