IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > My developerWorks >  Dashboard > WebSphere eXtreme Scale V6.1 User Guide > ... > Programming the ObjectGrid > ObjectGrid ObjectMap Programming API > Information > Page Comparison
developerWorks
Log In   View a printable version of the current page.
Overview Connect Spaces Forums Wikis
ObjectGrid ObjectMap Programming API
compared with
Current by saif.patel@us.ibm.com
on Jan 26, 2009 16:49.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 {include:OG_HEADER}
 {style}
 h3 {
 color: #0099cc;
 }
 h4 {
 color: #0099cc;
 }
 h5 {
 color: #0099cc;
 }
  {style}{excerpt}The ObjectMap API provides a transactional map-based API that allows typical CRUD (Create, Read, Update and Delete) operations to the ObjectGrid cache. Similar, to the java.util.Map interface, it also adds cache-specific semantics such as: batch access methods, entry eviction timeouts, locking hints and entry copy mode overrides (for safety and performance). {excerpt}
  {style}{excerpt}The ObjectMap API provides a transactional map-based API that allows typical CRUD (Create, Read, Update and Delete) operations to the ObjectGrid cache. Similar to the java.util.Map interface, it also adds cache-specific semantics such as: batch access methods, entry eviction timeouts, locking hints, and entry copy mode overrides (for safety and performance). {excerpt}
  
 h3. Getting Started
  
 * [Introduction to ObjectMaps]
 * [ObjectMap and JavaMap interfaces]
 * [Using maps as FIFO queues]
  
 h3. Examples and Tutorials
  
 The following example illustrates how to obtain ObjectMap and perform storing, finding, updating, and removing object operations using ObjectMap API:
 {code:title=ObjectMapExample.java}
 import com.ibm.websphere.objectgrid.ObjectGrid;
 import com.ibm.websphere.objectgrid.ObjectGridManager;
 import com.ibm.websphere.objectgrid.ObjectGridManagerFactory;
 import com.ibm.websphere.objectgrid.ObjectMap;
 import com.ibm.websphere.objectgrid.Session;
  
 public class ObjectMapExample {
  
  public static void main(String[] args) throws Throwable {
  ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
  ObjectGrid ivObjectGrid = objectGridManager.createObjectGrid("objectgridName");
  ivObjectGrid.defineMap("myMap");
  ivObjectGrid.initialize();
  Session ivSession = ivObjectGrid.getSession();
  
  // Obtaining ObjectMap from ObjectGrid Session
  ObjectMap objectMap = ivSession.getMap("myMap");
  
  // storing an Object
  ivSession.begin();
  objectMap.insert("key", "value");
  ivSession.commit();
  
  // Finding an Object
  ivSession.begin();
  String cachedObject = (String) objectMap.get("key");
  ivSession.commit();
  
  // Updating an Object
  ivSession.begin();
  cachedObject = (String) objectMap.get("key");
  cachedObject = cachedObject + "_newValue";
  objectMap.put("key", cachedObject);
  ivSession.commit();
  
  // Removing an Object
  Object removedObject = objectMap.remove("key");
  }
 }
 {code}
  
 h3. Related Information
  
 * [ObjectMap API documentation|http://www.ibm.com/developerworks/wikis/objectgridprog/docs/api/com/ibm/websphere/objectgrid/ObjectMap.html]
  
 {include:OG_FOOTER}

 
    About IBM Privacy Contact