1 Reply Latest reply on Mar 29, 2011 6:38 PM by Elias Ross

    How to use Cache<K,V> API In place of TreeCache

    thanuj kumar Newbie

      Infinispan encourages use of Cache<K,V> API  instead of TreeCache (TreeCache exists only for backward compatibility). I have simple requirement as below.

       

        Map<key,Map<key,Map<key,value>>>   (key - (holds key and map (holds key and value))

       

      I thought (i may be wrong) of  to use Cache api instead of TreeCache and use ConcurrentHashMap that would result in  Cache<String, Map<String, Map<String, String>>>, first issue i found is Map.put() doesn't reflect any change across cluster except for local. I believe reason is cache doesn't create any proxy to know put and other operations on our Map.

       

      If we want that each operation on key to be atomic and not required to serialize complete Map for replication, how could we accomplish this? Is it using AtomicHashMap of Infinispan? if so how is node/Fqn relation with respect to TreeCache?.

       

       

      Regards,

      Thanuj

        • 1. How to use Cache<K,V> API In place of TreeCache
          Elias Ross Master

          I would go as many as one Cache per type of thing, like in a relational database, how you divide your data into separate table.

           

          Conceptually, AtomicHashMap is used for mapping, say, an object into columns of a database. But most of the time, you don't need this level of fine-grained replication.

           

          I think the documentation should probably compare Infinispan to the familiar RDBMS persistence model.