[ 
https://issues.apache.org/jira/browse/SHIRO-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13607310#comment-13607310
 ] 

Mark Spritzler commented on SHIRO-317:
--------------------------------------

I've also noticed that I ran into the last issue posted here.

http://shiro-user.582556.n2.nabble.com/Cache-called-too-many-times-per-request-td6851915.html#a6855260

Basically, there are more than one thread running and calling the Cache and 
CacheManager, so while this will cut down a bit on the number of calls to the 
back end cache, it still doesn't seem to be the best solution. So say instead 
of 50-100 calls it is down to 30-50. or anywhere form 25-35% less calls. So I 
am thinking it would need to be attached to the request rather than a Thread.

In our case of using Spring Data Redis's RedisTemplate, and since there isn't a 
simple place to add an @Transactional then the template will open and close a 
connection for each and every call to the cache, which means open and closing 
30-50 connections in one request.

Mark
                
> Read session from cache once per request
> ----------------------------------------
>
>                 Key: SHIRO-317
>                 URL: https://issues.apache.org/jira/browse/SHIRO-317
>             Project: Shiro
>          Issue Type: New Feature
>    Affects Versions: 1.1.0, 1.2.0, 1.2.1
>            Reporter: Luke Biddell
>            Assignee: Les Hazlewood
>            Priority: Minor
>             Fix For: 1.3.0
>
>
> As per our discussion on the mailing thread, I've wired up my sessions to be 
> stored in memcached (membase in the longer term). On a per request basis I'm 
> seeing approximately 5 hits on my cache to retrieve the session. I would 
> expect to see only one hit per threaded request, with the session stored as a 
> thread local.
> For distributed caches this saves on network calls and for local caches it 
> will save on potential lock contention.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to