-
1. Re: Handling expiration events in the app
galder.zamarreno Jul 5, 2012 7:34 PM (in response to vdzhuvinov)1 of 1 people found this helpfulHave you tried if CacheEntryRemovedEvent works for your use case?
-
2. Re: Handling expiration events in the app
vdzhuvinov Jul 7, 2012 7:19 AM (in response to galder.zamarreno)Hi Galder,
CacheEntryRemovedEvent is meant for explicit removal only, not for removal due to expiration.
What we ultimately did was to create our own expiration logic and then use Infinispan's cache entry removed event to distribute the message to local and remote nodes.
I still find it a bit odd that expire events are not supported, given the fact that remove events are.
-
3. Re: Handling expiration events in the app
galder.zamarreno Jul 10, 2012 1:03 PM (in response to vdzhuvinov)Ah yes, I forgot. The jira issue that you linked explains some of the caveats of implementing this, particularly when the expired elements are not in memory but in the cache store.
The other slight problem is that a lot of the logic to check for expired elements is within the inner data container, where we can remove entries directly without emitting any notifications.
Btw, out of curiosity, what kind of things do you do when the entry is expired?
-
4. Re: Handling expiration events in the app
vdzhuvinov Jul 10, 2012 3:08 PM (in response to galder.zamarreno)The system in question acts as an enterprise JSON web service for Single Sign-On (SSO), shared session management and OpenID Connect IdP/IdC.
Expiration events are primarily used with sessions:
- Send web events to listenening apps that a user's session has expired.
- Release shared session data objects.
- Release optional LDAP connection bound as the user during the session.
- Register event with the session logger.
- Update various user stats.
We spent about three months evaluating Ehcache/Terracotta and Infinispan, and in the end decided to settle for the latter, despite the lack of Infinispan expiration events. These we reproduced by creating our own expiration logic on top of Infinispan.
The whole experience is worth writing a book
-
5. Re: Handling expiration events in the app
galder.zamarreno Jul 14, 2012 4:02 AM (in response to vdzhuvinov)I dunno the JBoss Application Server code by hard, but this is the kind of stuff the clustering integration code needs to deal with, so I'd suggest you dig a little into https://github.com/jbossas/jboss-as/tree/master/clustering to see what's done when web sessions expire and how they deal with capturing these events. I suspect that, as if you're already doing, they might have an external service, within the web container, that tells them when a session has expired, and so end up with a similar solution to yours.
I'd love to read that book