0

I'm wondering how to configure coorectly caching for my own extension.

So far i did the following:

ext_localconf.php

if (!is_array($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY])) {
  $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY] = array();
  $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['frontend'] = 'TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend';
  $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend';
  $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['options']['compression'] = 1;
}

in my TestController.php i wrote this:

$this->cache = $GLOBALS['typo3CacheManager']->getCache(
            $this->request->getControllerExtensionKey()
);

$cacheIdentifier = sha1('form_data_' . $GLOBALS["TSFE"]->id);

$formData = array();


if ($this->cache->has($cacheIdentifier)) { //This always results to false
  $formData = $this->cache->get($cacheIdentifier);
} else {
  $conditions = array(
     path' => $this->settings['httpClient']['baseUrl'] . 'list.xml'
  );

  $formData = $this->TestRepository->getFormData($conditions);
  $this->cache->set($cacheIdentifier,$formData);
}

So i didn't know what i do wrong.

Can somebody point me to the right direction.

I'm working with TYPO3 6.1.5 extbase 6.1.0

MadeOfSport
  • 513
  • 1
  • 7
  • 19

1 Answers1

1

Ok i found the answer as i checked TYPO3_CONF_VARS for FLUID Tamplates:

They had some different Cache Configurations:

After channging ext_localconf.php to

$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['frontend'] =
'TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['backend'] =
'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend';

everything works fine.

MadeOfSport
  • 513
  • 1
  • 7
  • 19
  • when you have time, can you maybe explain why the "default" frontend and backend cache concepts do not work? – Ole K Jul 06 '15 at 13:32
  • Yes i can. I habe excluded the action Form being cached for different reasons. I have similar requests to a REST service which i cache from "Hand" – MadeOfSport Jul 06 '15 at 13:37
  • what i actually wanted to know is for what reason I ned to replace the default frontend cache with some other for example? – Ole K Jul 06 '15 at 15:35