php - Disable Cache in TYPO3 in a USER_INT function -
i working on typo3 project have dynamically disable caching based on condition. specific usecase, not happen lot.
i planned use user_int function, perform check , disable cache if necessary. user_int function works flawlessly, being called on every page load.
the thing is, can not disable cache, or @ least not know how.
the code, have right now:
page = page page { typenum = 0 adminpanelstyles = 0 11 = user_int 11.userfunc = [company_namespace]\pagehandler->checkcache
and in function perform check:
public function checkcache($content,$conf){ global $tsfe; $id = $tsfe->id; if($this->checkifdisablecache($id)){ //$tsfe->set_no_cache(); // <---- first tried 1 $tsfe->no_cache=true; // <-----after while got despoerate , tried disable directly } }
i tried play config, did not work. funny thing is, if set directly in typoscript:
config.no_cache = 1
it works, since check rather complex, want use php determine, if cache should disabled.
i know doing wrong, don't know what. appretiated :)
i don't think either of previous answers explain situation. have sort of catch-22 here, in user_int
executed after page cache entry has been generated. way works internally can cached gets rendered first, , every user_int
outputs marker in html source gets replaced afterwards. way cache can contain version markers , can rendered without having render whole page.
so need in case if want page cache disabled in conditions, use custom typoscript condition capable of setting config.no_cache = 1
under special circumstances. way prevent generating cache entry if condition met, preserve full caching , cached output every other request.
note still recommended instead create parts of page must not cached, user_int
objects. having use case in cases need disable entire page cache indicates possible misunderstanding of how caching framework and/or user_int
works. above explains parts bit.
Comments
Post a Comment