Basic Data Access ExampleThis example shows the most basic data access features of Coherence including getting, putting and removing data. Java Basic Data Access Example
Associate a ContactId with a Contact in the cache: cache.put(contactId, contact); Retrieve the Contact associated with a ContactId from the cache: contact = (Contact) cache.get(contactId); Remove mapping of ContactId to Contact from the cache: cache.remove(contactId); .NET Basic Data Access Example
Associate a ContactId with a Contact in the cache: cache.Add(contactId, contact); Retrieve the Contact associated with a ContactId from the cache: contact = (Contact)cache[contactId]; Remove mapping of ContactId to Contact from the cache: cache.Remove(contactId); C++ Basic Data Access Example
Associate a ContactId with a Contact in the cache: hCache->put(vContactId, vContact); Retrieve the Contact associated with a ContactId from the cache: vContact = cast<Managed<Contact>::View>(hCache->get(vContactId));
Remove mapping of ContactId to Contact from the cache: hCache->remove(vContactId); Sample Data Access OutputThe example Output (due to Observer Example): entry inserted: John Nocyefqgqo Addresses Home: 1500 Boylston St. null Obopnof, NM 88824 US Work: 8 Yawkey Way null Ssedhvmdeq, OR 84217 US Phone Numbers work: +11 0 707 3776578 Birth Date: 1971-12-31 entry deleted: John Nocyefqgqo Addresses Home: 1500 Boylston St. null Obopnof, NM 88824 US Work: 8 Yawkey Way null Ssedhvmdeq, OR 84217 US Phone Numbers work: +11 0 707 3776578 Birth Date: 1971-12-31 |