Hello!

new TextQuery<Integer, Person>(Person.class, "PERSON_ID")

It looks that you are looking for a text "person_id" in all text fields of
Person.class. Are you sure this is something you want here? Perhaps you
wanted ScanQuery instead?

Regards,
-- 
Ilya Kasnacheev


вт, 22 янв. 2019 г. в 21:12, AndrewV <[email protected]>:

> 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&lt;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/
>

Reply via email to