/** * method to retrieve the cache instance * * @return Billrun_Cache */ public static function cache() { try { if (!self::$cache) { $args = self::config()->getConfigValue('cache', array()); if (empty($args)) { return false; } self::$cache = Billrun_Cache::getInstance($args); } return self::$cache; } catch (Exception $e) { Billrun_Factory::log('Cache instance cannot be generated', Zend_Log::ALERT); } return false; }
/** * method to get the instance of the class (singleton) */ public static function getInstance(array $args = array()) { if (count($args) < 2) { Billrun_Factory::log('Cache is not configured well. Not enough args to instantiate', Zend_Log::ERR); return false; } // default value of automatic_serialization is true if (!isset($args[2])) { $args[2] = array(); $args[2]['automatic_serialization'] = true; } elseif (!isset($args[2]['automatic_serialization'])) { $args[2]['automatic_serialization'] = true; } $args[2]['logging'] = true; $args[2]['logger'] = Billrun_Factory::log(); // if not set back-end, take it from front-end if (!isset($args[3])) { $args[3] = $args[2]; } if (is_null(self::$instance)) { $cache = forward_static_call_array(array('Zend_Cache', 'factory'), $args); self::$instance = new self($cache); } return self::$instance; }
/** * method to retrieve the cache instance * * @return Billrun_Cache */ public static function cache() { if (!self::$cache) { $args = self::config()->getConfigValue('cache', array()); if (empty($args)) { return false; } self::$cache = Billrun_Cache::getInstance($args); } return self::$cache; }