TreelistCacheUpdateHooks
Class that hooks into DataHandler and listens for updates to pages to update the treelist cache
this is a concrete TYPO3 hook implementation and solely used for EXT:frontend and not part of TYPO3's Core API.
Table of Contents
Methods
- __construct() : mixed
- Constructor, adds update requiring fields to the default ones
- moveRecord_afterAnotherElementPostProcess() : mixed
- Waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated
- moveRecord_firstElementPostProcess() : mixed
- waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated
- processCmdmap_postProcess() : mixed
- Waits for DataHandler commands and looks for deleted pages or published pages, if found further changes take place to determine whether the cache needs to be updated
- processDatamap_afterDatabaseOperations() : mixed
- waits for DataHandler commands and looks for changed pages, if found further changes take place to determine whether the cache needs to be updated
- clearCacheForAllParents() : mixed
- Clears the treelist cache for all parents of a changed page.
- clearCacheWhereUidInTreelist() : mixed
- Clears the treelist cache for all pages where the affected page is found in the treelist
- determineClearCacheActions() : array<string|int, mixed>
- Determines what happened to the page record, this is necessary to clear as less cache entries as needed later
- processClearCacheActions() : mixed
- Calls the cache maintenance functions according to the determined actions
- removeExpiredCacheEntries() : mixed
- Removes all expired treelist cache entries
- requiresUpdate() : bool
- Checks whether the change requires an update of the treelist cache
- setCacheExpiration() : mixed
- Sets an expiration time for all cache entries having the changed page in the treelist.
Methods
__construct()
Constructor, adds update requiring fields to the default ones
public
__construct() : mixed
moveRecord_afterAnotherElementPostProcess()
Waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated
public
moveRecord_afterAnotherElementPostProcess(string $table, int $recordId, int $destinationPid, int $originalDestinationPid, array<string|int, mixed> $movedRecord, array<string|int, mixed> $updatedFields, DataHandler $dataHandler) : mixed
Parameters
- $table : string
-
Table name of the moved record
- $recordId : int
-
The record's uid
- $destinationPid : int
-
The record's destination page id
- $originalDestinationPid : int
-
(negative) page id th page has been moved after
- $movedRecord : array<string|int, mixed>
-
The record that moved
- $updatedFields : array<string|int, mixed>
-
Array of changed fields
- $dataHandler : DataHandler
-
DataHandler parent object
moveRecord_firstElementPostProcess()
waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated
public
moveRecord_firstElementPostProcess(string $table, int $recordId, int $destinationPid, array<string|int, mixed> $movedRecord, array<string|int, mixed> $updatedFields, DataHandler $dataHandler) : mixed
Parameters
- $table : string
-
Table name of the moved record
- $recordId : int
-
The record's uid
- $destinationPid : int
-
The record's destination page id
- $movedRecord : array<string|int, mixed>
-
The record that moved
- $updatedFields : array<string|int, mixed>
-
Array of changed fields
- $dataHandler : DataHandler
-
DataHandler parent object
processCmdmap_postProcess()
Waits for DataHandler commands and looks for deleted pages or published pages, if found further changes take place to determine whether the cache needs to be updated
public
processCmdmap_postProcess(string $command, string $table, int $recordId, array<string|int, mixed> $commandValue, DataHandler $dataHandler) : mixed
Parameters
- $command : string
-
The TCE command
- $table : string
-
The record's table
- $recordId : int
-
The record's uid
- $commandValue : array<string|int, mixed>
-
The commands value, typically an array with more detailed command information
- $dataHandler : DataHandler
-
The DataHandler parent object
processDatamap_afterDatabaseOperations()
waits for DataHandler commands and looks for changed pages, if found further changes take place to determine whether the cache needs to be updated
public
processDatamap_afterDatabaseOperations(string $status, string $table, mixed $recordId, array<string|int, mixed> $updatedFields, DataHandler $dataHandler) : mixed
Parameters
- $status : string
-
DataHandler operation status, either 'new' or 'update'
- $table : string
-
The DB table the operation was carried out on
- $recordId : mixed
-
The record's uid for update records, a string to look the record's uid up after it has been created
- $updatedFields : array<string|int, mixed>
-
Array of changed fields and their new values
- $dataHandler : DataHandler
-
DataHandler parent object
clearCacheForAllParents()
Clears the treelist cache for all parents of a changed page.
protected
clearCacheForAllParents(int $affectedParentPage) : mixed
gets called after creating a new page and after moving a page
Parameters
- $affectedParentPage : int
-
Parent page id of the changed page, the page to start clearing from
clearCacheWhereUidInTreelist()
Clears the treelist cache for all pages where the affected page is found in the treelist
protected
clearCacheWhereUidInTreelist(int $affectedPage) : mixed
Parameters
- $affectedPage : int
-
ID of the changed page
determineClearCacheActions()
Determines what happened to the page record, this is necessary to clear as less cache entries as needed later
protected
determineClearCacheActions(string $status, array<string|int, mixed> $updatedFields) : array<string|int, mixed>
Parameters
- $status : string
-
DataHandler operation status, either 'new' or 'update'
- $updatedFields : array<string|int, mixed>
-
Array of updated fields
Return values
array<string|int, mixed> —List of actions that happened to the page record
processClearCacheActions()
Calls the cache maintenance functions according to the determined actions
protected
processClearCacheActions(int $affectedPage, int $affectedParentPage, array<string|int, mixed> $updatedFields, array<string|int, mixed> $actions) : mixed
Parameters
- $affectedPage : int
-
uid of the affected page
- $affectedParentPage : int
-
parent uid of the affected page
- $updatedFields : array<string|int, mixed>
-
Array of updated fields and their new values
- $actions : array<string|int, mixed>
-
Array of actions to carry out
removeExpiredCacheEntries()
Removes all expired treelist cache entries
protected
removeExpiredCacheEntries() : mixed
requiresUpdate()
Checks whether the change requires an update of the treelist cache
protected
requiresUpdate(array<string|int, mixed> $updatedFields) : bool
Parameters
- $updatedFields : array<string|int, mixed>
-
Array of changed fields
Return values
bool —TRUE if the treelist cache needs to be updated, FALSE if no update to the cache is required
setCacheExpiration()
Sets an expiration time for all cache entries having the changed page in the treelist.
protected
setCacheExpiration(int $affectedPage, int $expirationTime) : mixed
Parameters
- $affectedPage : int
-
Uid of the changed page
- $expirationTime : int