Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay DXP 7.0 Caching Web Content Structure/Templates
I have created a web content structure with 4 fields: role, button name, button image, and url - and a seperator. I then created a template for the structure that iterates through the entries and draws buttons (clickable divs) based on whether you have the correct role for the button.
This actually works. For instance, my user account has 2 of the roles and I see two buttons. BUT, when I impersonate a user that has 3 roles, I still see 2 roles. Sounds like an issue with impersonate, but it's not.
If I log out, then go to a different page and impersonate the user with 3 roles and THEN go to the template, I see 3 buttons. If It stop impersonating, I STILL see 3 buttons even though I only have access to 2.
So that seems to be a caching issue. I've turned off Freemarker caching (Configuration -> System Setings -> Foundation -> Freemarker Engine), but that seems to make no difference whatsoever.
Anyone else know why Liferay is acting this way? Is there a way to prevent it from doing this?
This actually works. For instance, my user account has 2 of the roles and I see two buttons. BUT, when I impersonate a user that has 3 roles, I still see 2 roles. Sounds like an issue with impersonate, but it's not.
If I log out, then go to a different page and impersonate the user with 3 roles and THEN go to the template, I see 3 buttons. If It stop impersonating, I STILL see 3 buttons even though I only have access to 2.
So that seems to be a caching issue. I've turned off Freemarker caching (Configuration -> System Setings -> Foundation -> Freemarker Engine), but that seems to make no difference whatsoever.
Anyone else know why Liferay is acting this way? Is there a way to prevent it from doing this?
John CressmanI have created a web content structure with 4 fields: role, button name, button image, and url - and a seperator. I then created a template for the structure that iterates through the entries and draws buttons (clickable divs) based on whether you have the correct role for the button.
This actually works. For instance, my user account has 2 of the roles and I see two buttons. BUT, when I impersonate a user that has 3 roles, I still see 2 roles. Sounds like an issue with impersonate, but it's not.
If I log out, then go to a different page and impersonate the user with 3 roles and THEN go to the template, I see 3 buttons. If It stop impersonating, I STILL see 3 buttons even though I only have access to 2.
So that seems to be a caching issue. I've turned off Freemarker caching (Configuration -> System Setings -> Foundation -> Freemarker Engine), but that seems to make no difference whatsoever.
Anyone else know why Liferay is acting this way? Is there a way to prevent it from doing this?
As template processing can involve service calls, it can be really costly. For this reason, each template itself has a "cacheable" checkbox. Go to the template editor and find that checkbox. Uncheck it. Done.
I'd expect the Freemarker Engine caching rather to affect the new parsing of the template rather than the new execution of the template - e.g. I'd recommend to leave it switched on. However, this (second statement) is only my expectation, not my knowledge or experience. Take it with a grain of salt.
Olaf KockJohn CressmanI have created a web content structure with 4 fields: role, button name, button image, and url - and a seperator. I then created a template for the structure that iterates through the entries and draws buttons (clickable divs) based on whether you have the correct role for the button.
This actually works. For instance, my user account has 2 of the roles and I see two buttons. BUT, when I impersonate a user that has 3 roles, I still see 2 roles. Sounds like an issue with impersonate, but it's not.
If I log out, then go to a different page and impersonate the user with 3 roles and THEN go to the template, I see 3 buttons. If It stop impersonating, I STILL see 3 buttons even though I only have access to 2.
So that seems to be a caching issue. I've turned off Freemarker caching (Configuration -> System Setings -> Foundation -> Freemarker Engine), but that seems to make no difference whatsoever.
Anyone else know why Liferay is acting this way? Is there a way to prevent it from doing this?
As template processing can involve service calls, it can be really costly. For this reason, each template itself has a "cacheable" checkbox. Go to the template editor and find that checkbox. Uncheck it. Done.
I'd expect the Freemarker Engine caching rather to affect the new parsing of the template rather than the new execution of the template - e.g. I'd recommend to leave it switched on. However, this (second statement) is only my expectation, not my knowledge or experience. Take it with a grain of salt.
Thank you very much! That was it! A word to anyone else who does this - after you make the change to the template, even the cacheable change, you have to go back to the web content and repubublish it for it to take effect.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™