6 Replies Latest reply on Jun 18, 2014 8:40 AM by dinoop.p1

    Expiration Listener

    brackxm

      Is it possible to listen to expiration events?

      I do not get CacheEntryRemoved events on expiration and there is no explicit CacheEntryExpired event.

      Using 5.0.1

        • 1. Re: Expiration Listener
          brackxm

          Apparently that feature was rejected

          https://issues.jboss.org/browse/ISPN-694

          My usecase is for a local cache.

          • 2. Re: Expiration Listener
            galder.zamarreno

            Michale, Manik explains the reasons to reject it in the JIRA.

             

            If this is really important for you, maybe you can find a way to implement it while avoiding the issues Manik indicates? You could even submit a patc or Git pull request for us to review

            • 3. Re: Expiration Listener
              galder.zamarreno

              Also, if you explain us your use case in detail, maybe we can find alternative ways of achieving what you're after.

              • 4. Re: Expiration Listener
                brackxm

                My usecase is to gradullay store less information over time.

                The original plan was to listen for expiration events and update the values.

                The workaround is to immediately store different data sets in different caches with different lifetimes.

                • 5. Re: Expiration Listener
                  galder.zamarreno

                  Listen for expiration events and update which values? Where are these values located?

                   

                  If the cache is backed by a cache store and you enable passivation in the cache store, you could listen for @CacheEntryPassivated which happens when entries expire.

                  • 6. Re: Expiration Listener
                    dinoop.p1

                    I have a similar problem. I am using Infinispan to store a stateMachine. All requests to my system (IN in telecommunication which handles the mobiles calls) will contain a session Id. Based on the session Id I will fetch the state machine from  cache and does some operation. When final response comes I will write cdr based on the stateMachine data then removes it from cache.

                     

                    But in actual scenario due to some network problem I may not always get the final request for a session Id. For all session's the CDR is mandatory (It is used for Billing). If an expiration listener  were present in infinispan, I can write the cdr at the time of stateMachine expiry.

                     

                     

                    How can I achieve this ? Any alternative solutions?

                    Thanks in advance.