See the Shiro documentation on how to turn on caching. When Caching in turned on , the Realm methods will not get called everytime.
Manoj On Fri, Oct 28, 2011 at 6:11 AM, Pham Tran Quoc Viet <[email protected]> wrote: > Hi All, > I have two questions: > 1) How do I initialize both authentication and authorization at the time of > log-in. I want to do this to avoid querying db twice (one for authentication > and one for authorization)? Any sample code would be the easiest to get me > started. > 2) Each time I call currrentUser.login() (just for testing purpose as > multiple login does not happen in real life), doGetAuthenticationInfo is > called. As a result, db is queried. Each time I call > currrentUser.hasRole(), doGetAuthorizationInfo is then called. As a result, > db is queried again. How do I avoid this repeated db queries? > Thanks. -- http://khangaonkar.blogspot.com/
