我想知道如何为我自己的扩展配置 coorectly 缓存。
到目前为止,我做了以下事情:
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;
}
在我的 TestController.php 我写了这个:
$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);
}
所以我不知道我做错了什么。
有人可以指出我正确的方向。
我正在使用 TYPO3 6.1.5 extbase 6.1.0