When overridden in a derived class, inserts a cache entry into the cache, without requiring that an existing cache entry with a matching key be returned.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
|Add(CacheItem, CacheItemPolicy)||When overridden in a derived class, tries to insert a cache entry into the cache as a CacheItem instance, and adds details about how the entry should be evicted.|
|Add(String, Object, DateTimeOffset, String)||When overridden in a derived class, inserts a cache entry into the cache without overwriting any existing cache entry.|
|Add(String, Object, CacheItemPolicy, String)||When overridden in a derived class, inserts a cache entry into the cache, specifying information about how the entry will be evicted.|
The method overloads try to insert a cache entry into the cache, without overwriting or removing an existing cache entry that has the same key. The cache entry can be a typed CacheItem object or a generic object.
The AddOrGetExisting method overloads and the method overloads have one significant difference. When these methods insert a cache entry, if a matching entry is found in the cache, the AddOrGetExisting method overloads return the existing cache entry, but the method overloads do not. Having these different method overloads enables callers to optimize their code based on whether they need the existing cache entry. In distributed caches, returning an existing value by using the AddOrGetExisting method might be more expensive than returning a Boolean value by using method.