/**
  * Get result from Ericsson
  *
  * @param string $name Service name at ericsson.ini
  * @param string $sp   Optional service provider
  */
 protected function _getEricssonList($name, $sp = null, $filter = false)
 {
     // Cache hit?
     $cacheId = \App_Util_String::toCacheId($sp ? $name . '_' . $sp : $name);
     if ($data = $this->getCache()->load($cacheId)) {
         return $data;
     }
     // Cache miss
     $data = $this->_processResponse($name, $sp);
     if ($filter) {
         $this->_filterServiceProviderData($data, $sp);
     }
     // Cache store
     $tags = $sp ? array($sp) : array();
     $this->getCache()->save($data, $cacheId, $tags);
     return $data;
 }
Exemplo n.º 2
0
 /**
  * Generate cache id with prefix to avoid collisions
  *
  * @param  string $transactionId
  * @return string
  */
 protected function _getCacheId($transactionId)
 {
     return 'tx' . \App_Util_String::toCacheId($transactionId);
 }
Exemplo n.º 3
0
 protected function _createCacheTags($tags = array())
 {
     $tags = array_merge($tags, $this->_tags);
     $tags = array_values(array_unique($tags));
     array_walk($tags, function (&$tag, $key) {
         $tag = \App_Util_String::toCacheId($tag);
     });
     return $tags;
 }
Exemplo n.º 4
0
 /**
  *
  * @param  string $resource
  * @param  string $key
  * @return array
  */
 protected function _getConfig($resource, $key)
 {
     if (!in_array($resource, array(self::RESOURCE_REPORT, self::RESOURCE_SIM))) {
         throw new InvalidArgumentException("Invalid config resource ({$resource})");
     }
     if (!in_array($key, array(self::KEY_HEADERS, self::KEY_FILTERS, self::KEY_FILE_HEADERS, self::KEY_FILE_FOOTERS))) {
         throw new InvalidArgumentException("Invalid config key ({$key})");
     }
     // Get CSV configuration
     $cacheId = \App_Util_String::toCacheId('csv_config_' . $resource);
     $config = \App::cache()->load($cacheId);
     if (empty($config)) {
         $config = new \Tid_Zend_Config_Yaml(APPLICATION_PATH . "/modules/default/views/csv/{$resource}.yml");
         \App::cache()->save($config, $cacheId);
     }
     return $config;
 }