Hi guys!

I have 2 caches, let's say 
*Cache<String, Person> presonCache* which *Read-through*
and *Cache<String, Organization> organizationCache*
we assume that each key guaraneed to be uniqe for unique entity.
Classes are:
Person {
    String name; // get/set
    .. other fields...
}
Organization {
    String name; // get/set
    Set<String> employees // consists of personCache's keys. Represents
one-to-many relation.
}

what i need to do is to make sure that if Organization o1 present in the
*organizationCache*, then all its employees need to be presend in the
*personCache* if they present in the underlying storage.
If some of them were not present(CacheStorage wasn't able to load them),
they should be removed from Organization.employees set.

There are 2 options i'm aware of:
 1) Wrap both caches into Service and handle consistency via
IgniteTransactions and custom logic.
There is no guarantees if someone will *ignite.cache(CACHE_NAME).put(k,v);*
 2) ContinuousQuery.setLocalListener(...)
Seemse to be just what is needed, but we have to do it synchronously and
person might be in many organizations, thus there is porential for deadlock
(we could sort keys though).

What's your solution of such case would be?



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Keep-two-caches-consistent-tp14322.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to