This documentation is archived and is not being maintained.

MemoryCache.AddOrGetExisting Method

Inserts a cache entry into the cache.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method AddOrGetExisting(CacheItem, CacheItemPolicy) Adds a cache entry into the cache using the specified CacheItem instance and details about how to evict the entry. (Overrides ObjectCache.AddOrGetExisting(CacheItem, CacheItemPolicy).)
Public method AddOrGetExisting(String, Object, DateTimeOffset, String) Adds a cache entry into the cache using the specified key and a value and an absolute expiration value. (Overrides ObjectCache.AddOrGetExisting(String, Object, DateTimeOffset, String).)
Public method AddOrGetExisting(String, Object, CacheItemPolicy, String) Inserts a cache entry into the cache using the specified key and value and the specified details for how it is to be evicted. (Overrides ObjectCache.AddOrGetExisting(String, Object, CacheItemPolicy, String).)
Top

The AddOrGetExisting method overloads are used to insert a cache entry into the cache. If a cache entry with a matching key does not exist, these methods insert a new entry. If a cache entry with a matching key already exists, they return the existing entry.

Show: