You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fortress@directory.apache.org by Jan Sindberg <js...@autorola.com> on 2015/12/01 10:39:06 UTC

Cache lifecycle

I am trying to understand how caching is best utilized when working with Fortress.
I find that the Ehcache is renewed whenever I create a new AccessMgr - by that I mean that the instances does not share a cache. So if I want to maximize performance in my application, then I need to create and keep a global singleton instance. I have yet to test that the cache actually runs out and is refreshed if I keep a singleton.
I find that the session is not backed by any AccessMgr or any cache. So if I keep a session as long as the user is logged in, then changes newer reaches the user (unless the user logs out and in again).
Where does the cache have impact and what is the right way of working with the different Fortress entities?

SV: Cache lifecycle

Posted by Jan Sindberg <js...@autorola.com>.
>From : Jan Sindberg [mailto:jsi@autorola.com]
> 
> I find that the Ehcache is renewed whenever I create a new AccessMgr - by
> that I mean that the instances does not share a cache. So if I want to
> maximize performance in my application, then I need to create and keep a
> global singleton instance. I have yet to test that the cache actually runs out
> and is refreshed if I keep a singleton.

I am using the default ehcache.xml configuration with timeToIdleSeconds="600" and timeToLiveSeconds="600".
I find that if I keep an accessMgr and creates a new session, then there is no delay on changes, which means that I don't see any caching? 

In our application I set a breakpoint in a class with a static accessMgr. Then I fire up some evaluation of code fragments and do this:
Session session = accessMgr.createSession(new User("test"), true);
session.getRoles();

Then I add or remove roles in Fortress Commander and repeat. The change is instant. I don't think that Fortress Commander knows how to reset the cache in my application? I was considering implementing a reset through our event-bus, but it looks like there is no need?