【发布时间】:2019-06-06 08:47:56
【问题描述】:
我正在尝试在我的插件中使用 Produclist 缓存。
我的 ext_localconf.php
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['product_cache'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['product_cache'] = [];
}
if( !isset($GLOBALS['TYPO3_CONF_VARS'] ['SYS']['caching']['cacheConfigurations']['product_cache']['frontend'] ) ) {
$GLOBALS['TYPO3_CONF_VARS'] ['SYS']['caching']['cacheConfigurations']['product_cache']['frontend'] = 'TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend';
}
还有我的控制器
$cache = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('product_cache');
if(($products = $cache->get($cacheIdentifier)) === FALSE){
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$productController = $objectManager->get(ProductController::class);
$productController->setSettings($this->settings);
$products = $productController->getEditedProducts($catId);
$cache->set($cacheIdentifier, $products, ['productajax'], 84600);
}
字符串、整数或数组等普通内容可以正常工作,但是当我使用 DatabaseResultquerie 尝试此操作时,系统会因以下错误而崩溃:Call to a member function map() on null
(仅在获取时,设置工作正常)
【问题讨论】:
标签: php caching typo3 extbase typo3-9.x