Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] unique alias cache miss resolution strategy "fetchPagesAndR…
…etry" Previously, if unique alias cache did not yield a hit, URLs could not be resolved. This commit adds generic support for cache miss resolution strategies and provides "fetchPagesAndRetry" as first strategy implementation. "fetchPagesAndRetry" attempts to resolve a miss situation on unique cache by fetching configured URLs which should populate the unique cache again. In order to allow the called pages to populate the unique cache, encoding caches for the pages which are supposed to apply the unique aliases need to be cleared. To achieve this, the sub-array clearPageCache of strategy_conf will be passed to clearPageCacheMgm if configured. The URLs to be fetched (configured as sub-array urls of strategy_conf) are only supposed to populate the cache, e.g. for tt_news this should be a page listing links to all news (per language). The cache only needs to be cleared for all pages linked to from those listing pages (e.g. the caches should be cleared for the pages used as tt_news "single" views, while the listing pages contain "list" views linking to those "single" pages). Why cache misses are a problem: mydomain.com uses tt_news with an overview listing on first level /news and single view on /news/single/..., so generated URLs look like: http://mydomain.com/en/news/single/my-news-title/ If the unique alias cache table is emptied, without cache miss resolution my-news-title can no longer be resolved. This is especially the case if users received a link to a news article via search engines or e-mail. Once TYPO3 generates a link to that news article again, the unique alias table gets re-populated. How to solve with fetchPagesAndRetry strategy: Since lookup works again after news articles have been linked once, this strategy simply calls pages linking to those articles. Since we already got an overview listing on /news, we can simply configure those URLs to be called. Unfortunately, if the encode cache still contains entries for those pages & articles, re-generation of unique aliases will be skipped. This can be solved by clearing RealURL caches for the target (single view) pages linked to (/news/single, assuming to be page 123 in example below). Usage example: 'GETvar' => 'tx_ttnews[tt_news]', 'lookUpTable' => array ( ... 'useUniqueCache' => '1', 'useUniqueCache_conf' => array ( 'strtolower' => '1', 'spaceCharacter' => '-', 'cacheMissResolution' => array( 'strategy' => 'fetchPagesAndRetry', 'strategy_conf' => array( 'clearPageCache' => array( 'pageIdArray' => array( // pages being linked to for viewing news // (i.e. the pages requiring the unique alias // lookup) 123 ), ), 'urls' => array( // pages generating links to news 'http://mydomain.com/nc/en/news/', 'http://mydomain.com/nc/de/news/', ) ), ), ), ),
- Loading branch information