【发布时间】:2013-10-12 15:26:51
【问题描述】:
我想知道如何为我自己的扩展配置 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 扩展库 6.1.0
【问题讨论】: