[TYPO3-dev] cHash: additional parameter that frontend user/group is logged in
Bernhard Kraft
kraftb at kraftb.at
Tue May 9 01:04:05 CEST 2006
Jan-Hendrik Heuing [DD] wrote:
> Cached content has got some "meta-data". Those contain type and page-id for
> example, those things which render diferent cache results WITHOUT using
> cHash. And as far as I remember, usergroups are part of it !
It might sound like you would have to ask your local dealer :) But there is
a method "getHash" in tslib_fe.php:
---------
function getHash() {
$this->hash_base = serialize(
array(
'all' => $this->all,
'id' => intval($this->id),
'type' => intval($this->type),
'gr_list' => (string)$this->gr_list,
'MP' => (string)$this->MP,
'cHash' => $this->cHash_array
)
);
return md5($this->hash_base);
}
-----------
The hash from this method get's used for storing page-relevant information like TSConfig,
the cached page, etc. in the cache -tables ... and as you can see this->gr_list is part
of it ...
so if your extension does not display different content to every single FE-User but just
to groups you will be happy without cHash ...
I suppose this feature is mandatory as by default different content can get shown to different
usergroups in TYPO3 (using the Access select box at the bottom of every CE/page, etc).
If the group lists would not get included into the cache-hash this feature would not work properly
with cached pages.
If you require different caching for every user I think it would be the best to extend this method
and add the logged-in user ID to this array. But always remember that in the worst case you blow up
your databse by cached_pages*n_FE_users entries !!!
Another method would be to add a &user= parameter to the URL and generate a cHash for everypage as
you intended (I guess you will only require it for the pages your plugin resides on...
If you just intend to output a small section containing the acutally logged in user-name I would
rather prefer an _INT object which is not cached - i would only let each user/page combination get
cached if generating the specific page takes a lot of resources.
PS (also for others) : If you want to hide the cHash parameter from your website vistors you can use
realURL for this and add the following config to the localconf.php realURL configuration:
'init' => array(
'appendMissingSlash' => 'ifNotFile',
'enableCHashCache' => 1,
),
greets,
Bernhard
--
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
[[ http://think-open.at | Open source company ]]
More information about the TYPO3-dev
mailing list