1 Reply Latest reply on Oct 18, 2013 4:56 AM by Radoslav Husar

    Using Infinispan in place of Session

    umesh awasthi Newbie

      Hi All,

       

      I am trying to understand if i can use Infinispan to store my Shopping Cart data in place of HTTP Session?

      I need to store Shopping Cart object for my application and i have following options

       

      1. Store it in DB (which i am doing ) and fetch it every time user want to look in to it.
      2. Store Cart in DB and place data in say Session or Cache and server user from Cache.
      3. In case any change in Cart, update DB and update snapshot in Session or cache.

       

      Though HTTP session seems to good choice, but i can see few issues with it

      1. Application will run to memory once number of concurrent session will increase.
      2. Not sure how scalable this approach will be.

       

      We are already using Infinispan in our application and i was wondering if i can use it for this use case.I have a very limited knowledge about Infinispan and how it works so though about getting my doubts cleared before moving forward.

       

      Looking forward for your inputs

       

      Thanks

      Umesh

        • 1. Re: Using Infinispan in place of Session
          Radoslav Husar Master

          I am trying to understand if i can use Infinispan to store my Shopping Cart data in place of HTTP Session?

          Yes, you can. You can define a cache in the AS container, inject it to your EE application and access the cache directly and do anything you need.

           

          Store it in DB (which i am doing ) and fetch it every time user want to look in to it.

          The performance aspect should be solvable by using Hibernate 2nd level cache which uses Infinispan. You don't want to fetch from DB every time.

           

          In case any change in Cart, update DB and update snapshot in Session or cache.

          That doesn't sound reasonable to me. For instance you cannot effectively change the session as that event happens.