/**
  * Reads the necessary data from the flexform, builds the web service
  * request url and gets the data from the web serivce.
  *
  * @param string $content the PlugIn content
  * @param array  $conf    the PlugIn configuration
  *
  * @return string The string containing the template output or an error message
  *              if debug is enabled.
  */
 public function main($content, $conf)
 {
     $this->pi_USER_INT_obj = 1;
     $this->conf = $conf;
     //no cache when logged into backend or no_cache parameter set
     $useCache = $GLOBALS['BE_USER']->user == null && !isset($_REQUEST['no_cache']);
     $cacheId = sha1($this->cObj->data['pi_flexform'] . $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
     $content = $this->cache->get($cacheId);
     if ($content === false || !$useCache) {
         $content = $this->render();
         $this->cache->set($cacheId, $content, array(), $this->cacheLifeTime);
     }
     return $this->pi_wrapInBaseClass($content);
 }
 /**
  * @test
  * @author Robert Lemke <*****@*****.**>
  * @author Karsten Dambekalns <*****@*****.**>
  * @author Ingo Renner <*****@*****.**>
  */
 public function getFetchesStringValueFromBackend()
 {
     $backend = $this->getMock('t3lib_cache_backend_AbstractBackend', array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'findIdentifiersByTags', 'flush', 'flushByTag', 'flushByTags', 'collectGarbage'), array(), '', FALSE);
     $backend->expects($this->once())->method('get')->will($this->returnValue('Just some value'));
     $cache = new t3lib_cache_frontend_StringFrontend('StringFrontend', $backend);
     $this->assertEquals('Just some value', $cache->get('StringCacheTest'), 'The returned value was not the expected string.');
 }