PHP Class DmitryDulepov\Realurl\Cache\DatabaseCache

Inheritance: implements DmitryDulepov\Realurl\Cache\CacheInterface, implements TYPO3\CMS\Core\SingletonInterface
Show file Open project: dmitryd/typo3-realurl

Public Properties

Property Type Description
$maximumNumberOfRecords integer

Protected Properties

Property Type Description
$databaseConnection TYPO3\CMS\Core\Database\DatabaseConnection

Public Methods

Method Description
__construct ( ) Initializes the class.
clearExpiredCacheEntries ( ) : void Removes expired path cache entries.
clearPathCacheForPage ( integer $pageId ) : void Empties the path cache for one page.
clearUrlCache ( ) : mixed Empties the URL cache.
clearUrlCacheById ( string $cacheId ) : void Clears URL cache by cache id.
clearUrlCacheForPage ( integer $pageId ) : void Empties the URL cache for one page.
expireCache ( integer $pageId, integer | null $languageId = null ) : void Expires cache for the given page and language.
getPathFromCacheByPageId ( integer $rootPageId, integer $languageId, integer $pageId, string $mpVar ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Obtains non-expired (!) path from the path cache.
getPathFromCacheByPagePath ( integer $rootPageId, integer $languageId, string | null $mountPoint, string $pagePath ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Obtains path from the path cache.
getUrlFromCacheByOriginalUrl ( integer $rootPageId, string $originalUrl ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null Gets the entry from cache.
getUrlFromCacheBySpeakingUrl ( integer $rootPageId, string $speakingUrl, integer | null $languageId ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null Gets the entry from cache. Language id is needed here because in some cases URLs can be the same for different languages (_DOMAINS & use alias, for example).
putPathToCache ( DmitryDulepov\Realurl\Cache\PathCacheEntry $cacheEntry ) : void Puts path to the cache.
putUrlToCache ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry ) : void Sets the entry to cache.

Protected Methods

Method Description
limitTableRecords ( string $tableName ) : boolean Limits amount of records in the table. This does not run often.

Method Details

__construct() public method

Initializes the class.
public __construct ( )

clearExpiredCacheEntries() public method

Removes expired path cache entries.
public clearExpiredCacheEntries ( ) : void
return void

clearPathCacheForPage() public method

Empties the path cache for one page.
public clearPathCacheForPage ( integer $pageId ) : void
$pageId integer
return void

clearUrlCache() public method

Empties the URL cache.
public clearUrlCache ( ) : mixed
return mixed

clearUrlCacheById() public method

Clears URL cache by cache id.
public clearUrlCacheById ( string $cacheId ) : void
$cacheId string
return void

clearUrlCacheForPage() public method

Empties the URL cache for one page.
public clearUrlCacheForPage ( integer $pageId ) : void
$pageId integer
return void

expireCache() public method

Expires cache for the given page and language.
public expireCache ( integer $pageId, integer | null $languageId = null ) : void
$pageId integer
$languageId integer | null
return void

getPathFromCacheByPageId() public method

Obtains non-expired (!) path from the path cache.
public getPathFromCacheByPageId ( integer $rootPageId, integer $languageId, integer $pageId, string $mpVar ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$rootPageId integer
$languageId integer
$pageId integer
$mpVar string
return DmitryDulepov\Realurl\Cache\PathCacheEntry | null

getPathFromCacheByPagePath() public method

Obtains path from the path cache.
public getPathFromCacheByPagePath ( integer $rootPageId, integer $languageId, string | null $mountPoint, string $pagePath ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$rootPageId integer
$languageId integer
$mountPoint string | null null means exclude from search
$pagePath string
return DmitryDulepov\Realurl\Cache\PathCacheEntry | null

getUrlFromCacheByOriginalUrl() public method

Gets the entry from cache.
public getUrlFromCacheByOriginalUrl ( integer $rootPageId, string $originalUrl ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null
$rootPageId integer
$originalUrl string
return DmitryDulepov\Realurl\Cache\UrlCacheEntry | null

getUrlFromCacheBySpeakingUrl() public method

We may not fallback to the default language here!
public getUrlFromCacheBySpeakingUrl ( integer $rootPageId, string $speakingUrl, integer | null $languageId ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null
$rootPageId integer
$speakingUrl string
$languageId integer | null
return DmitryDulepov\Realurl\Cache\UrlCacheEntry | null

limitTableRecords() protected method

Records are removed in the uid order (oldest first). This is not a true clean up, which would be based on the last access timestamp but good enough to maintain performance.
protected limitTableRecords ( string $tableName ) : boolean
$tableName string
return boolean

putPathToCache() public method

Puts path to the cache.
public putPathToCache ( DmitryDulepov\Realurl\Cache\PathCacheEntry $cacheEntry ) : void
$cacheEntry DmitryDulepov\Realurl\Cache\PathCacheEntry
return void

putUrlToCache() public method

Sets the entry to cache.
public putUrlToCache ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry ) : void
$cacheEntry DmitryDulepov\Realurl\Cache\UrlCacheEntry
return void

Property Details

$databaseConnection protected property

protected DatabaseConnection,TYPO3\CMS\Core\Database $databaseConnection
return TYPO3\CMS\Core\Database\DatabaseConnection

$maximumNumberOfRecords public static property

public static int $maximumNumberOfRecords
return integer