ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ognen Duzlevski <ognen.duzlev...@gmail.com>
Subject Re: Getting all the keys in a cache
Date Tue, 21 Apr 2015 01:38:05 GMT
Just to follow up on this in case anyone runs into this thread - in Scala
the proper way to override the onUpdated() java method is:

class MyListener[K,V] extends CacheEntryUpdatedListener[K,V] {
      def
onUpdated(events:java.lang.Iterable[javax.cache.event.CacheEntryEvent[_<:K,_<:V]])
{
        events.foreach(x => println(s"${x.getKey},${x.getValue}")) //
replace with whatever you want
      }
  }

Took me some time to get the correct signature going.

Then you feed this to setLocalListener like this: setLocalListener(new
MyListener[<whatever is key type>,<whatever is value type>)

I am not sure how much coverage of the Java API us in the Scala API - it
did not look like much to me. In addition, wrapping everything into scalar
{}  on the scala side did not seem terribly useful but maybe I am missing
something.

On Mon, Apr 20, 2015 at 12:08 PM, Ognen Duzlevski <ognen.duzlevski@gmail.com
> wrote:

> Nice, thanks!
>
> On Mon, Apr 20, 2015 at 12:06 PM, Valentin Kulichenko <
> valentin.kulichenko@gmail.com> wrote:
>
>> Ognen,
>>
>> You can use continuous queries for that:
>>
>> https://ignite.incubator.apache.org/releases/1.0.0/javadoc/org/apache/ignite/cache/query/ContinuousQuery.html
>>
>> On Mon, Apr 20, 2015 at 10:02 AM, Ognen Duzlevski <
>> ognen.duzlevski@gmail.com
>> > wrote:
>>
>> > Hello,
>> >
>> > I am looking at the
>> > https://ignite.incubator.apache.org/releases/1.0.0/javadoc/ page and I
>> > cannot find a method to just get all the keys in a particular cache. All
>> > the get() methods require a known key or a set of known keys. What if I
>> > have one app that is filling up the cache and another one that is
>> > inspecting the same cache periodically for key/value changes?
>> >
>> > Thanks!
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message