Fóruns

Início » Liferay Portal » English » 2. Using Liferay » General

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Mitko Zafirovski
Liferay 6.0.6 Permission Handler Caching
19 de Junho de 2012 01:48
Resposta

Mitko Zafirovski

Ranking: Junior Member

Mensagens: 27

Data de entrada: 1 de Março de 2012

Mensagens recentes

Hello all.

These days i've been playing around with the cache on liferay as i have two web apps that need to share the data. I have found out how to disable the entity level cache on some of liferays entites but the one thing that is bugging me is the permission handler. Ok in my portal.ext.properties i have the following lines.

value.object.finder.cache.enabled.com.liferay.portal.model.User=false
value.object.finder.cache.enabled.Users_Roles=false
value.object.entity.cache.enabled.com.liferay.portal.model.User=false
value.object.entity.cache.enabled.Users_Roles=false
value.object.entity.cache.enabled.com.liferay.portal.model.Layout=false
value.object.finder.cache.enabled.com.liferay.portal.model.Layout=false
value.object.finder.cache.enabled.com.liferay.portal.model.Role=false
value.object.entity.cache.enabled.com.liferay.portal.model.Role=false



And for example if in the data base i change a user to not be active the change is caught by liferay instantly. But for the permission is not the same. I also tested the folowing in one browser i open liferay with the Omniadmin user and in the control panel was searching for the user. When i change someing in the db and press refresh the roles shown for the user were changed, but still when the user logs in the permissions were the same. Can some one tell me if i need something other caching to disable?
David H Nebinger
RE: Liferay 6.0.6 Permission Handler Caching
19 de Junho de 2012 06:06
Resposta

David H Nebinger

Ranking: Liferay Legend

Mensagens: 6211

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

Mitko Zafirovski:
Can some one tell me if i need something other caching to disable?


Your mistake is updating the database directly.

If you invoked the Liferay API to make these changes, you would not need to mess with the cache and the permissions would be updated correctly.

The Liferay database should, at all times, be treated like a black box. You do not own the tables/values/etc in the database, Liferay does.
Mitko Zafirovski
RE: Liferay 6.0.6 Permission Handler Caching
19 de Junho de 2012 23:28
Resposta

Mitko Zafirovski

Ranking: Junior Member

Mensagens: 27

Data de entrada: 1 de Março de 2012

Mensagens recentes

I know that database should not be updated directly i was using that just as an example. I need the permission checker not to cache the roles because i am changing the roles from a different web app. I was asking if there is a way to disable the permission checker cache the same way i managed to disable the role and user entity cache?
Hitoshi Ozawa
RE: Liferay 6.0.6 Permission Handler Caching
24 de Junho de 2012 06:33
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7990

Data de entrada: 23 de Março de 2010

Mensagens recentes

I was asking if there is a way to disable the permission checker cache the same way i managed to disable the role and user entity cache?


I don't think you really want to do this because liferay checks permission on every asset each time. Disabling the cache would really slows down your liferay - liferay depends on cache for performance.
David H Nebinger
RE: Liferay 6.0.6 Permission Handler Caching
24 de Junho de 2012 07:07
Resposta

David H Nebinger

Ranking: Liferay Legend

Mensagens: 6211

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

Mitko Zafirovski:
I know that database should not be updated directly i was using that just as an example. I need the permission checker not to cache the roles because i am changing the roles from a different web app. I was asking if there is a way to disable the permission checker cache the same way i managed to disable the role and user entity cache?


Again, you should be using the Liferay API and not updating the database directly. In this case your other web app should be invoking the Liferay web services to update the user roles. Using the API will ensure that the cache is updated appropriately.
Mitko Zafirovski
RE: Liferay 6.0.6 Permission Handler Caching
24 de Junho de 2012 12:04
Resposta

Mitko Zafirovski

Ranking: Junior Member

Mensagens: 27

Data de entrada: 1 de Março de 2012

Mensagens recentes

Guys thanks for replaying and tell me why i should not disable the caching. But i already know all the reasons why not to disable the cache and still i need to because of things i am not in liberty to disclose on this forum. I know that is very bad to do that and i know what am i doing atm. I was just simply asking how can i disable the permission caching. If u know the answer please share it with me. If not thanks for the advice you have given me so far.
David H Nebinger
RE: Liferay 6.0.6 Permission Handler Caching
25 de Junho de 2012 06:13
Resposta

David H Nebinger

Ranking: Liferay Legend

Mensagens: 6211

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

The answer I'm giving has nothing to do w/ caching vs not caching.

It is simply one of the golden rules of Liferay - do not access the database directly, always use the Liferay API.

Whether it's a caching issue, an indexing issue, some sort of database upgrade issue, doesn't really matter. Any time you access the database directly you break the Liferay API contract, and when you break the contract you're bound to have issues. Right now you know about the caching thing because that's as far as you've gotten, but there could be many other things that are potentially not working that you haven't stumbled upon yet.

We're not saying "don't disable the cache" or not providing the info because we're trying to hide anything. We're saying that, from our experience, any time you hit the database directly things just don't work the way you'd expect, and therefore it should be avoided.

Liferay provides a full web service for many of their APIs, and you can use the client jar to leverage those calls. Most of the heavy lifting has already been done, you just have the integration stuff to worry about.