ObjectCache::AddOrGetExisting Method
When overridden in a derived class, tries to insert a cache entry into the cache, and returns an existing cache entry with a matching key.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
| Name | Description | |
|---|---|---|
![]() | AddOrGetExisting(CacheItem^, CacheItemPolicy^) | When overridden in a derived class, inserts the specified CacheItem object into the cache, specifying information about how the entry will be evicted. |
![]() | AddOrGetExisting(String^, Object^, CacheItemPolicy^, String^) | When overridden in a derived class, inserts a cache entry into the cache, specifying a key and a value for the cache entry, and information about how the entry will be evicted. |
![]() | AddOrGetExisting(String^, Object^, DateTimeOffset, String^) | When overridden in a derived class, inserts a cache entry into the cache, by using a key, an object for the cache entry, an absolute expiration value, and an optional region to add the cache into. |
The AddOrGetExisting method overloads insert an entry into the cache. If a cache entry with a matching key already exists, they return the existing entry. The cache entry can be a CacheItem object or a generic object.
There is one difference between the AddOrGetExisting overloads and the Add overloads. When these overloaded methods try to insert a cache entry, if an existing entry is found that has a key that matches an existing inserted cache entry, the AddOrGetExisting overloads return the existing cache entry. The Add overloads do not.
