shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Spritzler (JIRA)" <>
Subject [jira] [Commented] (SHIRO-317) Read session from cache once per request
Date Wed, 20 Mar 2013 22:47:15 GMT


Mark Spritzler commented on SHIRO-317:

OK, stay with me here. How about this suggestion, and it is based on what I have tried so
far. It is actually pretty funny, but I think it might be the best solution.

So I tried storing it in ServletRequest only for that to still have the problem results as
I had with storing it in ThreadLocal with ThreadContext. I still had at least 100 calls to
the cache per request.

OK, actually my suggestion was going to be your last suggestion. The 2 ties of caching. Which
you kind of already have, it is just a chaining of caches. So take your in memory Map cache
as the tier 1, and then tier 2 be the enterprise networked cache. That is what I just ended
up with and it did remove all those calls to the back end cache. There are still about 11
calls to the cache in one request.

Here is that code
> Read session from cache once per request
> ----------------------------------------
>                 Key: SHIRO-317
>                 URL:
>             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:

View raw message