Forums / Developer / cache and users
laurent le cadet
Wednesday 09 June 2010 5:24:38 am
Hi,
I have added an integer field to the user class definition.I would like to display or not contents base on the value of this integer.
In pagelayout, i can read this value like this :{$current_user.contentobject.data_map.credit.content}
This could be a cache key for contents in the mainarea but I'm not really sure if it's the good strategy.
Could someone tell me more about that, a bad cache manipulation can be very negative on performances.
Best regards.
Laurent
André R.
Wednesday 09 June 2010 6:58:57 am
If possible, use roles and policies (by using different user groups for instance) instead as they are supported by all caches (for cache blocks they are supported out of the box using $user_hash: http://svn.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/pagelayout.tpl)
But if you don't need to vary by this in the view of your content and just in pagelayout, then it shouldn't affect performance that much as you can use this variable as part of cache-block keys that are used around the section where you use it.
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom
Wednesday 09 June 2010 7:05:44 am
André,
Roles and policies can't served me as users belongs to the same group.Contents I want to change are in $module_result, full or line view, which is rather different as this is the view cache which is concerned.