CacheMulti.php

Go to the documentation of this file.
00001 <?php
00002 
00034 class Robo47_Application_Resource_CacheMulti
00035 extends Zend_Application_Resource_ResourceAbstract
00036 {
00037 
00042     protected $_caches = array();
00043     
00044     public function init()
00045     {
00046         if (!empty($this->_options)) {
00047             foreach ($this->_options as $name => $options) {
00048                 $resource = new Robo47_Application_Resource_Cache($options);
00049                 $resource->init();
00050                 $this->_caches[$name] = $resource->getCache();
00051             }
00052         } else {
00053             $message = 'Empty options in resource ' .
00054                 'Robo47_Application_Resource_CacheMulti.';
00055             throw new Robo47_Application_Resource_Exception($message);
00056         }
00057     }
00058 
00065     public function getCache($name)
00066     {
00067         if (isset($this->_caches[$name])) {
00068             return $this->_caches[$name];
00069         } else {
00070             $message = 'Cache \'' . $name . '\' doesn\'t exist';
00071             throw new Robo47_Application_Resource_Exception($message);
00072         }
00073     }
00074 
00080     public function getCaches()
00081     {
00082         return $this->_caches;
00083     }
00084 }