[TYPO3-dev] Clearing cHash-specific cache
Bernhard Kraft
kraftb at kraftb.at
Wed Jan 4 13:16:30 CET 2006
Michael Scharkow wrote:
> Hi guys,
>
> while working on a FE-plugin using cHash for caching, I need to
> selectively delete a cache for a given cHash (or piVar-combination if
> you will):
>
> I am in edit mode for a specific record, with some piVars indicating the
> mode and the record, of course, and *after* successfully modifying the
> record, the cache should be cleared for this cHash, so that I get to see
> the updated page in single view.
>
> I could, of course, use
>
> tslib_fe::clearPageCacheContent_pidList($TSFE->id);
AFAIK the cHash is very hard to generate if you want to clear the cHash from
a different page than you are currently on (TSConfig is taken into account for
cHash)
Kasper made a possibilty to "register" a specific value (reg1 AND reg2) for each page
which get's stored in the cache_pages table.
You do that by setting the appropriate "register/object property" from within you extension
which renders the single view of a specific record UID for example (in my case):
$GLOBALS['TSFE']->page_cache_reg1 = $this->singleViewUid;
If the page then get's stored completly in cache (because you don't have a USER_INT - with those
it wouldn't make much sense) the value of this register will get stored in the reg1 and reg2
fields of the cache_pages table.
If you then would like to clear the cache for this page with the specific reg1/reg2 value you can
just do that by exec_DELETEquery as there is currently no method for clearing cache pages with
special reg1/reg2 values --- this would of course had to get added to the core API methods.
greets,
Bernhard
More information about the TYPO3-dev
mailing list