Hi Val,

Thank you for your nice reply. It works when I am creating one cache with a 
certain CacheConfiguration with interceptor, But I don't know how to changed 
the interceptor when the cache object is created.


PS: here is the code on creating a cache with interceptor.
public void testInterceptorWithConfigOnCreate() throws Exception {
    CacheConfiguration cfg = new CacheConfiguration(); 
    cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); // required, but 
ATOMIC
 
    cfg.setName(cache_name);
    cfg.setInterceptor(new PersonalInterceptor(1)); // combined with given 
interceptor
    ignite1.createCache(cfg); // create this cache with given name and 
interceptor.// NOTICE, the cfg will be cloned in the 
createCache/getOrCreateCache
    final IgniteCache<Integer, Person> cache = ignite1.cache(cache_name);
    Person p = new Person("Jason", "Green");
    cache.put(1,p);
    Person out = cache.get(1);
    assertEquals(p.getLastName().toUpperCase(), out.getLastName());}As I known, 
the CacheConfiguration object in the cache object is different from what I 
created, and I haven't found the right way to update the interceptor 
dynamically.I have read some codes like 
org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java,
 I think the method used only in test cases  
org.apache.ignite.testframework.junits.GridAbstractTest#getConfiguration(java.lang.String)
 was hacked in 
org.apache.ignite.internal.processors.cache.GridCacheOnCopyFlagAbstractSelfTest#cacheConfiguration,
 so the instance of CacheConfigurations are the same object.
But I have no idea how to do this in a real production environment.
Hopes for you reply.Thanks again.
Regards,
Lin Lyu.




------------------ Original ------------------
From:  "vkulichenko";<[email protected]>;
Date:  Sat, Nov 7, 2015 09:55 AM
To:  "user"<[email protected]>; 

Subject:  Re: How to filter the CacheInterceptor for a certain cacheefficiently?



Hi Lin Lyu,

Cahe interceptor is configured per cache (see
CacheConfiguration.setInterceptor() configuration property). So you don't
need to do any additional filtering, just set this configuration only for
one cache.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/How-to-filter-the-CacheInterceptor-for-a-certain-cache-efficiently-tp1864p1878.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to