Forums / Setup & design / ViewCaching per user

ViewCaching per user

Author Message

Franck Grenier

Wednesday 20 April 2011 7:29:56 am

Hello,

I'm having questions about viewCaching.

I work on an Intranet with almost 3000 users. ViewCaching is disabled. When I enabled it, caches are not regenerated and users do not see the most recent data.

First question : Should I really enable ViewCaching ?

Second question : If I enable ViewCaching with "pr_user" parameter, I guess my site could generate a very very large number of caches. Is it right ?

Developer at Open Wide

Marko Žmak

Wednesday 20 April 2011 11:46:04 pm

Yes, you should really enable ViewCaching. Usually you should disable it for some complex pages and use template cache-block on thoose pages instead.

As you can see in the docs:

  • http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Features/View-caching

view caching is not generated per user, but rather per set of permissions/preferences:

Please note that eZ Publish creates multiple view caches for the nodes based on roles and user preferences. This means that for example different users (who are logged in, with different permissions/preferences) will be served different caches while anonymous users and users with the same type of permissions/preferences will be served the same file. In other words, when view caching is on, the "view" view of the "content" module will only be run if the system is unable to locate a view-cached version of the result - otherwise a cached version will be inserted in the pagelayout. Please note that the pagelayout itself is not cached by default.

As for your problem, there can be several reason for it so you should investigate it a little bit further and give us some more info.

For example, the cache dir of your frontend siteaccess should be the same as the cache dir for the admin siteacces. Also, view cache for a node is regenerated only when the node is changed and published. Furthermore, the parts of the page that are in pagelayout.tpl do not use view cache. And so on...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Bertrand Dunogier

Thursday 21 April 2011 5:17:59 am

Sorry Marko but Franck is right: if you enable the ViewCacheTweak pr_user, ViewCaching will be generated per user. Franck, you can indeed try enabling it, and see how it performs. But it will indeed generate lots of cache files, as a combinatory of user + preferences if you have any. Cache clearing can then be quite heavy. But it is worth a try.

pr_user or not, as Marko said, it should get cleared when the related content is updated, as simple as that. Investigate based on what Marko told you, and you should figure it out. Ask again here if you need help.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Marko Žmak

Thursday 21 April 2011 6:47:05 am

"

Sorry Marko but Franck is right: if you enable the ViewCacheTweak pr_user, ViewCaching will be generated per user. Franck, you can indeed try enabling it, and see how it performs. But it will indeed generate lots of cache files, as a combinatory of user + preferences if you have any. Cache clearing can then be quite heavy. But it is worth a try.

"

Yes, sorry I didn't notice that part. But this proves that ViewCacheTweak should be documented in the official docs (and not only in Serwatka's hidden gems).

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Franck Grenier

Thursday 21 April 2011 7:24:53 am

Ok, I will try this. Or maybe not if i don't have time...

And don't mind eZ Publish ! You are well documented. ;-)

Developer at Open Wide

Bertrand Dunogier

Thursday 21 April 2011 8:22:32 am

"

Yes, sorry I didn't notice that part. But this proves that ViewCacheTweak should be documented in the official docs (and not only in Serwatka's hidden gems).

"

True, true... maybe you could file a documentation issue ? Our doc manager is quite responsive, we keep him well fed !

"

And don't mind eZ Publish ! You are well documented.

"

Thanks ! But you're being overly kind here ;-)

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Marko Žmak

Saturday 23 April 2011 2:21:51 am

"
"

Yes, sorry I didn't notice that part. But this proves that ViewCacheTweak should be documented in the official docs (and not only in Serwatka's hidden gems).

"

True, true... maybe you could file a documentation issue ? Our doc manager is quite responsive, we keep him well fed !

"

OK, here it is:

  • http://issues.ez.no/IssueView.php?Id=18277&activeItem=1

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth