ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevin <kevin.c...@leonardo.com>
Subject Re: CacheStore load/get and SQL
Date Thu, 24 Sep 2015 16:56:26 GMT
I'm trying to do something similar - run a query (ScanQuery or SqlQuery)
against the cache, and would like it to read-through.

My use case is this:
I store Person and Company objects in Ignite caches. Person objects have the
ID of the Company (which is also the key for the Company cache) they belong
I would like to retrieve the Persons in a given Company.

If I run a query against the Person cache (where companyId = x), it would
only return the Persons that in the cache.
I'm thinking of calling cache.loadCache to read all the Persons for a given
Company and caching them, and then calling cache.query(). I would need some
strategy to know to only call cache.loadCache when necessary, otherwise
there would be a database hit every time I do the query.. which would defeat
the purpose of the cache. Unless I always keep every Person in the cache
(without evicting/expiring them), then I won't need to call loadCache before
the query.

An alternative is to have the Company in the cache store a list of IDs of
all the Persons belonging to that Company, then I can do a simple key lookup
for the Persons, but I would have to maintain that list of IDs in the cache
when creating/deleting Persons.

Any suggestions to what I'm trying to accomplish?


View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheStore-load-get-and-SQL-tp582p1482.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message