<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 5:41 PM, Manik Surtani <span dir="ltr"><<a href="mailto:msurtani@redhat.com" target="_blank">msurtani@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On 28 Jan 2013, at 15:22, Vladimir Blagojevic <<a href="mailto:vblagoje@redhat.com" target="_blank">vblagoje@redhat.com</a>> wrote:</div>
<br><blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000">
<div>On 13-01-28 7:31 AM, Manik Surtani
wrote:<br>
</div>
<blockquote type="cite">
<div>
<blockquote type="cite">
<div dir="ltr"><p>If you're ok with changing the core, you could add a
getValue() method to CacheEntryCreatedEvent, and an
isCreated() method to CacheEntryModifiedEvent (as I
suppose you don't want to call the updates listener when
an entry is created). Both changes should be
backwards-compatible.<br>
</p>
</div>
</blockquote>
<div>That could work.</div>
</div>
</blockquote>
<br>
The second one Manik? As I was researching how to do this I found
you were against the first option
<a href="https://issues.jboss.org/browse/ISPN-881" target="_blank">https://issues.jboss.org/browse/ISPN-881</a><br></div></blockquote><div><br></div></div><div>Yes, isCreated().</div><div class="im"><br><blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite">
<div>
<blockquote type="cite">
<div dir="ltr"><div>
<br></div><p dir="ltr"><br>
> The second I have no idea how to implement as we do
not have<br>
> CacheEntryExpired event. True, spec is not rigorous
that such an event<br>
> has to be fired immediately after an entry has
expired but eventually<br>
> (which might be on access). Either way, I am all ears
on suggestions how<br>
> to implement this one.<br>
></p><p>I guess @CacheEntryEvicted/@CacheEntriesEvicted would be
the closest thing we have in Infinispan. But you can't
check in the listener if the entry was evicted because it
expired or because there wasn't enough space in the data
container (yet).<br>
</p>
</div>
</blockquote>
<div>There could definitely be something clever we could do
here. �Adding the (expired or evicted) entry to a queue for
later notification. �But that would definitely need to be
something we explicitly enable rather than have running all
the time, since it kinda defeats the purpose of evicting
something to save memory only to have it put in a different
queue elsewhere until an event is fired.</div>
</div>
</blockquote>
<br>
Exactly! One thing we could do is what RI does. Check for expired on
entry access from JSR module and during normal expired cleanup
cycle..... <br></div></blockquote><div><br></div></div><div>Be mindful of performance considerations here - this could get very expensive.</div><br></div></div></blockquote><div><br></div><div>Exactly. I don't think you can use a queue for later notification, because you also have to cancel the notification if the user updates the same key again. I mean if an entry was supposed to expire at 12:00 and the user did a put at 12:59 with expiration time 12:30, then he shouldn't get an expired notification at 12:00 - even if the entry was evicted in the meantime.<br>
<br></div><div>I think you'd need something like a cache store that only keeps the keys and their expiration time, and with passivation enabled. I don't think you can reuse the cache store code, though.</div></div>
</div></div>