0 Replies Latest reply on Nov 21, 2013 4:15 AM by Ankit Singh

    Can we code(put/get) to use Infinispan memory data grid along with DB.

    Ankit Singh Newbie



      I want to use infinispan cache data grid and want to code put and get methods and have client talking to infinispan server using hot rod protocol in hibernate layer. I don't want to use infinispan as second level cache for hibernate(put and get into cache is handled by hibernate).


      Using second level cache, search will be a hibernate search and most of the time will go to DB as we will have many updates and results will be invalidated from cache.


      I want my code to search from cache only and not from DB and add/update/delete happens in both cache and DB. Can I code this using infinispan data grid.  I would have to ensure that up to date information is always in cache (I.e. All update flows would have to update cache and DB).


      Use case:


      User ==> add employee(hibernate) ==> infinispan Cache ( I want to put employee into cache so that it is read from here and not from DB)

                                                                ==> Database(also adding into DB)


      User ==> search employee(hibernate) ==> infinispan Cache (I want to get employee from cache and not from DB. With 2 level cache, employee will be loaded from DB as it is not there in cache)


      User ==> update employee(hibernate) ==> infinispan Cache

                                                                     ==> Database


      User ==> search employee(hibernate) ==> infinispan Cache


      I want infinispan cache behaving as primary DB in case of search.

      I only want to know if it is feasible and what can be the risks associated with this like how to connect to infinispan and DB(teiid VDB) from hibernate layer at the same time and how to ensure that the data is in sync.