You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Brian Demers (JIRA)" <ji...@apache.org> on 2016/06/23 23:12:16 UTC

[jira] [Updated] (SHIRO-455) Allowing to cache WildcardPermission in WildcardPermissionResolver class

     [ https://issues.apache.org/jira/browse/SHIRO-455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Demers updated SHIRO-455:
-------------------------------
    Summary: Allowing to cache WildcardPermission in WildcardPermissionResolver class  (was: Allowing to cache WildcarPermission in WildcardPermissionResolver class)

> Allowing to cache WildcardPermission in WildcardPermissionResolver class
> ------------------------------------------------------------------------
>
>                 Key: SHIRO-455
>                 URL: https://issues.apache.org/jira/browse/SHIRO-455
>             Project: Shiro
>          Issue Type: Improvement
>          Components: Authorization (access control) , Caching 
>    Affects Versions: 1.2.1, 1.2.2
>            Reporter: Thibault Tigeon
>              Labels: features, patch
>         Attachments: shiro-core.patch
>
>
> Hello,
> I am benching Shiro, tahnks this method:
>     public void bench() {
>         final Subject subject = SecurityUtils.getSubject();
> 	subject.login(new UsernamePasswordToken(LOGIN+i, PWD));
> 	for (int ind = 0; ind < 100000; ind++) { // a lot of authorizations
> 	    assertTrue(subject.isPermitted("medias:album:read"));
> 	}
> 	subject.logout();
>     }
> I see that I waste my time in the methode WildCardPermissionResolver which create a new instance of permission each time even if it is the same String in parameter.
> I added a map which allows to cache WildcardPermission.
> You can find in attachement the patch.
> PS : the cache for authorisation is activated:
> cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
> securityManager.cacheManager = $cacheManager
> Regards,
> Thibault



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)