4 Replies Latest reply: Jul 6, 2011 1:45 AM by Amal Raj Vinoth James RSS

Local put

Vaclav Senych Newbie

Hello,
I've one question about Option parameter in "put" method. I am using option "setCacheModeLocal" when I need to make put only to local member of cluster. (I dont want to invalidate the same entries in other members.) Is this option intended for such purposes? How does affect listeners and eviction policy? I tried to dig in source code, but I was not able to find place, when Option makes it's work.

Thank you
Washeeq

  • 1. Re: Local put
    Manik Surtani Master

    Hi there

    Yeah thats pretty much what it is used for. If you set this option the replication interceptor will be bypassed. Everything else will function the same.

    Cheers,
    Manik

  • 2. Re: Local put
    Vaclav Senych Newbie

    Thanks Manik. I'm glad to hear it :-)

  • 3. Re: Local put
    Amal Raj Vinoth James Newbie

    Hi Manik,

     

    In Invalidation mode, I want put a entry in local cache alone it should not perfrom on other caches,

     

    How to achieve this?

    I didnot find anything like "setCacheModeLocal" as mentioned above.

    Where should i use option parameter "setCacheModeLocal"? 

     

    I tried setting mode as local at runtime as,

     

         cache.getConfiguration().setCacheMode(CacheMode.LOCAL);

         put(fqn,key,value);

     

    but it throws exception as follows:

     

         Exception in thread "main" org.jboss.cache.config.ConfigurationException:

              Attempted to modify a non-Dynamic configuration element [cacheMode] after the cache started!

     

    please help me regarding this.

     

    thanks in advance, amal raj.

  • 4. Re: Local put
    Amal Raj Vinoth James Newbie

    Yes it working for me by using:

     

    cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);

    cache.put(fqn, key, value);

     

    FYI: It applies to put() and remove() only.

     

    thanks, amal raj.