Tuesday 15 September 2015

Creating query and filtering for Coherence cache -



Creating query and filtering for Coherence cache -

i have simple pojo:

class person { string name; int age; }

and want able create index on cache allow me execute next pseudo-query:

find me people name equal john , age greaterthan 30

i've tried multiextractor appears create index want, when build query using filter objects, seem still end un-optimised queries.

easiest solution add together property accessors:

public class person { public person(string name, int age) { this.name = name; this.age = age; } public string getname() { homecoming name; } public int getage() { homecoming age; } private string name; private int age; }

now can query:

// find me people name equal // john , age greaterthan 30 filter filter = new andfilter( new equalsfilter("getname", "john"), new greaterfilter("getage", integer.valueof(30)); set setkeys = cache.keyset(filter);

you can code filter in sql. see: https://community.oracle.com/message/11217211#11217211

other resources:

http://vimeo.com/51314443 http://docs.oracle.com/middleware/1213/coherence/develop-applications/api_cq.htm#cohdg5263 https://www.youtube.com/user/oraclecoherence

oracle-coherence

No comments:

Post a Comment