Commit e207ea61 authored by Claus Due's avatar Claus Due Committed by Georg Ringer
Browse files

[TASK] Program to cache frontend interface, not implementations

Instead of annotating and type-hinting specific cache
frontend implementations, TYPO3 should program to
the FrontendInterface instead. This patch corrects that.

Change-Id: Ibc8d31cf78459e700ab9fe3448a53cbe83bccc61
Resolves: #81461
References: #81432
Releases: master
Reviewed-on: https://review.typo3.org/53116


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Tested-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 509037f6
......@@ -18,7 +18,7 @@ use Psr\Log\LoggerInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
......@@ -3575,7 +3575,7 @@ class BackendUtility
/**
* Gets an instance of the runtime cache.
*
* @return VariableFrontend
* @return FrontendInterface
*/
protected static function getRuntimeCache()
{
......
......@@ -838,7 +838,7 @@ class Bootstrap
// See if the Routes.php from all active packages have been built together already
$cacheIdentifier = 'BackendRoutesFromPackages_' . sha1((TYPO3_version . PATH_site . 'BackendRoutesFromPackages'));
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$codeCache = $this->getEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('cache_core');
$routesFromPackages = [];
if ($codeCache->has($cacheIdentifier)) {
......
......@@ -24,7 +24,7 @@ use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidIdentifierException;
use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidParentRowException;
use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidParentRowLoopException;
......@@ -684,7 +684,7 @@ class DataHandler implements LoggerAwareInterface
/**
* Runtime Cache to store and retrieve data computed for a single request
*
* @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
* @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected $runtimeCache = null;
......@@ -8947,7 +8947,7 @@ class DataHandler implements LoggerAwareInterface
/**
* Gets an instance of the runtime cache.
*
* @return VariableFrontend
* @return FrontendInterface
*/
protected function getRuntimeCache()
{
......
......@@ -146,7 +146,7 @@ class ReferenceIndex implements LoggerAwareInterface
/**
* Runtime Cache to store and retrieve data computed for a single request
*
* @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
* @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected $runtimeCache = null;
......
......@@ -2193,7 +2193,7 @@ class GraphicalFunctions
$statusHash = $this->generateStatusHashForImageFile($filePath);
$identifier = $this->generateCacheKeyForImageFile($filePath);
/** @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $cache */
/** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
$cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_imagesizes');
$imageDimensions = [
'hash' => $statusHash,
......@@ -2217,7 +2217,7 @@ class GraphicalFunctions
{
$statusHash = $this->generateStatusHashForImageFile($filePath);
$identifier = $this->generateCacheKeyForImageFile($filePath);
/** @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $cache */
/** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
$cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_imagesizes');
$cachedImageDimensions = $cache->get($identifier);
if (!isset($cachedImageDimensions['hash'])) {
......
......@@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface
{
/**
* @var \TYPO3\CMS\Core\Cache\Frontend\StringFrontend
* @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected $cacheInstance;
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Package;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Compatibility\LoadedExtensionArrayElement;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\ClassLoadingInformation;
......@@ -37,7 +38,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface
protected $dependencyResolver;
/**
* @var \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend
* @var FrontendInterface
*/
protected $coreCache;
......@@ -110,9 +111,9 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface
}
/**
* @param \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend $coreCache
* @param FrontendInterface $coreCache
*/
public function injectCoreCache(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend $coreCache)
public function injectCoreCache(FrontendInterface $coreCache)
{
$this->coreCache = $coreCache;
}
......
......@@ -17,7 +17,7 @@ namespace TYPO3\CMS\Core\Page;
use TYPO3\CMS\Backend\Routing\Router;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Localization\LocalizationFactory;
use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
......@@ -1367,7 +1367,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
$loadedExtensions = ExtensionManagementUtility::getLoadedExtensionListArray();
$isDevelopment = GeneralUtility::getApplicationContext()->isDevelopment();
$cacheIdentifier = 'requireJS_' . md5(implode(',', $loadedExtensions) . ($isDevelopment ? ':dev' : '') . GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT'));
/** @var VariableFrontend $cache */
/** @var FrontendInterface $cache */
$cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('assets');
$this->requireJsConfig = $cache->get($cacheIdentifier);
......
......@@ -1512,7 +1512,7 @@ tt_content.' . $key . $suffix . ' {
{
if ($allowCaching) {
$cacheIdentifier = self::getExtLocalconfCacheIdentifier();
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$codeCache = self::getCacheManager()->getCache('cache_core');
if ($codeCache->has($cacheIdentifier)) {
$codeCache->requireOnce($cacheIdentifier);
......@@ -1611,7 +1611,7 @@ tt_content.' . $key . $suffix . ' {
{
if ($allowCaching) {
$cacheIdentifier = static::getBaseTcaCacheIdentifier();
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$codeCache = static::getCacheManager()->getCache('cache_core');
$cacheData = $codeCache->requireOnce($cacheIdentifier);
if ($cacheData) {
......@@ -1731,7 +1731,7 @@ tt_content.' . $key . $suffix . ' {
*/
protected static function createBaseTcaCacheFile()
{
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$codeCache = self::getCacheManager()->getCache('cache_core');
$codeCache->set(
static::getBaseTcaCacheIdentifier(),
......@@ -1767,7 +1767,7 @@ tt_content.' . $key . $suffix . ' {
if ($allowCaching && !self::$extTablesWasReadFromCacheOnce) {
self::$extTablesWasReadFromCacheOnce = true;
$cacheIdentifier = self::getExtTablesCacheIdentifier();
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
/** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$codeCache = self::getCacheManager()->getCache('cache_core');
if ($codeCache->has($cacheIdentifier)) {
$codeCache->requireOnce($cacheIdentifier);
......
......@@ -42,7 +42,7 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface
protected $cacheManager;
/**
* @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
* @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected $dataMapCache;
......
......@@ -815,7 +815,7 @@ class ContentObjectRenderer
if ($cacheConfiguration !== null) {
$key = $this->calculateCacheKey($cacheConfiguration);
if (!empty($key)) {
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash');
$tags = $this->calculateCacheTags($cacheConfiguration);
$lifetime = $this->calculateCacheLifetime($cacheConfiguration);
......@@ -2861,7 +2861,7 @@ class ContentObjectRenderer
if (empty($key)) {
return $content;
}
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash');
$tags = $this->calculateCacheTags($conf['cache.']);
$lifetime = $this->calculateCacheLifetime($conf['cache.']);
......@@ -7084,7 +7084,7 @@ class ContentObjectRenderer
$cacheKey = $this->calculateCacheKey($configuration);
if (!empty($cacheKey)) {
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
/** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
$cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)
->getCache('cache_hash');
$content = $cacheFrontend->get($cacheKey);
......
......@@ -30,7 +30,7 @@ use TYPO3\CMS\Recycler\Utility\RecyclerUtility;
class DeletedRecordsController
{
/**
* @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
* @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected $runtimeCache = null;
......@@ -199,7 +199,7 @@ class DeletedRecordsController
/**
* Gets an instance of the memory cache.
*
* @return \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
* @return \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
*/
protected function getMemoryCache()
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment