Adds an element with the provided key and value to the IDictionary.

Namespace: GemStone.GemFire.Cache.Generic
Assembly:  GemStone.GemFire.Cache (in GemStone.GemFire.Cache.dll)


void Add(
	TKey key,
	TValue value
Visual Basic (Declaration)
Sub Add ( _
	key As TKey, _
	value As TValue _
Visual C++
void Add (
	TKey key, 
	TValue value


The object to use as the key of the element to add.
The object to use as the value of the element to add.


If remote server put fails throwing back a CacheServerException or security exception, then local put is tried to rollback. However, if the entry has overflowed/evicted/expired then the rollback is aborted since it may be due to a more recent notification or update by another thread.

For local region instance - creates a new entry in this region with the specified keyvaluepair in the local cache only. For distributed region instance - The new entry is propogated to the java server to which it is connected with.


GemStone.GemFire.Cache.Generic..::IllegalArgumentException if key is null
GemStone.GemFire.Cache.Generic..::EntryExistsException if an entry with this key already exists
GemStone.GemFire.Cache.Generic..::CacheWriterException if CacheWriter aborts the operation
GemStone.GemFire.Cache.Generic..::CacheListenerException if CacheListener throws an exception
GemStone.GemFire.Cache.Generic..::CacheServerException If an exception is received from the Java cache server. Only for Native Client regions.
GemStone.GemFire.Cache.Generic..::NotConnectedException if not connected to a GemFire system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException.
GemStone.GemFire.Cache.Generic..::RegionDestroyedException if region has been destroyed
GemStone.GemFire.Cache.Generic..::TimeoutException if the operation timed out
GemStone.GemFire.Cache.Generic..::OutOfMemoryException if there is not enough memory for the new entry

See Also