I have a Spring application with Ignite cache configured according to samples
- https://apacheignite-mix.readme.io/docs/spring-caching
*My configured Spring bean:*
--------------------------------------------------------------
/@Bean
public SpringCacheManager springCacheManager() {
SpringCacheManager cm = new SpringCacheManager();
IgniteConfiguration igniteConf = new IgniteConfiguration();
igniteConf.setClientMode(true);
/* Dynamic cache configuration */
CacheConfiguration dynamicCacheConfig = new CacheConfiguration();
dynamicCacheConfig.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.TEN_MINUTES));
dynamicCacheConfig.setCacheMode(CacheMode.PARTITIONED);
dynamicCacheConfig.setBackups(0);
dynamicCacheConfig.setIndexedTypes(Integer.class, Object.class);
cm.setDynamicCacheConfiguration(dynamicCacheConfig);
return cm;
}/
--------------------------------------------------------------
For caching I use Spring Cache annotation in service layer:
*Service example*:
/@Cacheable("getPersonById_cache")
Person getPersonById(int id) {...}
@Cacheable("getPersonsByParams_cache")
List<Person> getPersonsByParams(...) {...}/
*What I want to achieve:*
When I'm changing Person entity I want to revalidate
getPersonsByParams_cache, but just records (List) which contain this Person.
So I decided to use Cache Queries (scan or text) to find matching records in
the cache, something like that:
/IgniteCache<Integer, Person> cache = Ignition.ignite().cache(cacheName);
QueryCursor<javax.cache.Cache.Entry<Integer, Person>> result =
cache.query(new TextQuery<Integer, Person>(Person.class, "PERSON_ID"));
System.out.println(result.getAll());/
but my result is always empty...
Maybe we have another way to achieve that?
Thanks.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/