Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2013-07-17T14:47:14Z by André Teixeira
Rooman
Rooman
6 Posts
ACCEPTED ANSWER

Pinned topic Programmatic Eviction of Cache

‏2013-04-22T12:46:31Z |

Hello There,

I would be interested to know in how many ways you can evict the side cache and if there is any tutorial on that, that could be really helpful. I am using WXS alongside WESB.

Thanks,

Syed

  • jhanders
    jhanders
    257 Posts
    ACCEPTED ANSWER

    Re: Programmatic Eviction of Cache

    ‏2013-05-01T12:18:03Z  in response to Rooman

    Programmatically you can do it with ObjectMap.invalidate or ObjectMap.remove.  The Evictor interface is also available for customers to implement themselves.  The product includes several built-in evictors.  Time to Live eviction has multiple flavors including last access time, last update time, and creation time where eviction is based off of the last time an entry was ever accessed (includes gets), the last time an entry was updated/inserted (excludes gets), or just when it was initially inserted into the grid.  Both an LRU and LFU evictor is also provided by the eXtreme Scale runtime.

    How are you using WXS with WESB?  Are you using the mediation node that is provided for WESB, or you are just using WXS as a normal client in WESB?

    I hope that helps.  Reply back if you need additional information.

    Jared Anderson

    • Rooman
      Rooman
      6 Posts
      ACCEPTED ANSWER

      Re: Programmatic Eviction of Cache

      ‏2013-05-01T12:47:17Z  in response to jhanders

      Hello Jared,

      Yes, I am using WXS with WESB as normal client as the WPS version I am working on is WPS7. It does not have the WXS node which is available in newer version. We are also using XS as side cache. Since this is starting to work on

      Thanks for your input. Will post anything if feel necessary. 

      Syed

    • Rooman
      Rooman
      6 Posts
      ACCEPTED ANSWER

      Re: Programmatic Eviction of Cache

      ‏2013-05-01T13:08:02Z  in response to jhanders

      Ok. I read your statement and I have a question now -

      My scenario - A service call response I am caching, but if any other service call out of some specific four other service calls will be made which basically changes the data in the backend then to referesh the stale data eviction is necessary, does specifying ttlEvictorType="LAST_MODIFY_TIME"  in the map where I am caching the response, will help in this case?

      I can see in the other similar scenarios, the company is using Java API to evict it, which I feel if can be done specifying this could be lot more simpler and maintainable. But only if what i described above is possible.

      I appreciate your response in advance.

      Syed

      • jhanders
        jhanders
        257 Posts
        ACCEPTED ANSWER

        Re: Programmatic Eviction of Cache

        ‏2013-06-10T10:56:25Z  in response to Rooman

        LAST_UPDATE_TIME will allow the entry to be evicted after a set period of time since it was last inserted or updated.  CREATION_TIME will allow for it to be evicted after a set period of time after it is inserted into the grid.

        If you are wanting an update of the backend to trigger an eviction, you will need to introduce logic where you update your backend, that you also evict the cache, or you need to have the backend be able to trigger itself to allow you to call eviction on any caches.

        I hope this helps answer your question.

        Jared Anderson

      • André Teixeira
        André Teixeira
        1 Post
        ACCEPTED ANSWER

        Re: Programmatic Eviction of Cache

        ‏2013-07-17T14:47:14Z  in response to Rooman

        Hello,

        Well I tried to override (programmatically, because its supposed to be dynamic) BackingMapConfiguration to LRU w/ CREATION_TIME w/ a TTL of 2 sec, and when I debug apparently the new config overrides the old one, I insert a new value on the map, and for my surprise it lives on and on...and on, much more then it should be, forever!

        Is there something, some config I am missing?

                     ObjectGridConfiguration objectGridConfiguration = ObjectGridConfigFactory.createObjectGridConfiguration("Grid");

                     BackingMapConfiguration orderLineMapConfig = ObjectGridConfigFactory.createBackingMapConfiguration("Map1");

                     Plugin evictorPlugin =  ObjectGridConfigFactory.createPlugin(PluginType.EVICTOR,"com.ibm.websphere.objectgrid.plugins.builtins.LRUEvictor");

                     orderLineMapConfig.addPlugin(evictorPlugin);

                     orderLineMapConfig.setTimeToLive(ttl);

                     orderLineMapConfig.setTtlEvictorType(TTLType.CREATION_TIME);

                    objectGridConfiguration.addBackingMapConfiguration(orderLineMapConfig);

        Getting my grid:

        objGridManager.getObjectGrid(this.clientClusterContext, "Grid", objectGridConfiguration);

         

        Thank you for your help,

        André Teixeira