ObjectCache
Class
Definition
Represents an object cache and provides the base methods and properties for accessing the object cache.
public abstract class ObjectCache : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>
- Inheritance
-
ObjectCache
- Derived
- Implements
Inherited Members
System.Object
Remarks
The ObjectCache type is the primary type for the in-memory object cache. To develop a custom cache implementation, you derive from the ObjectCache class.
Note
The ObjectCache class is new as of the .NET Framework 4.
The built-in MemoryCache class derives from the ObjectCache class. The MemoryCache class is the only concrete object cache implementation in the .NET Framework 4 that derives from the ObjectCache class.
Constructors
| ObjectCache() |
Called from constructors in derived classes in order to initialize the ObjectCache class. |
Fields
| InfiniteAbsoluteExpiration |
Gets a value that indicates that a cache entry has no absolute expiration. |
| NoSlidingExpiration |
Indicates that a cache entry has no sliding expiration time. |
Properties
| DefaultCacheCapabilities |
When overridden in a derived class, gets a description of the features that a cache implementation provides. |
| Host |
Gets or set a reference to a managed hosting environment that is available to ObjectCache implementations and that can provide host-specific services to ObjectCache implementations. |
| Item[String] |
Gets or sets the default indexer for the ObjectCache class. |
| Name |
Gets the name of a specific ObjectCache instance. |
Methods
| 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. |
| 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, 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. |
| 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. |
| Contains(String, String) |
When overridden in a derived class, checks whether the cache entry already exists in the cache. |
| CreateCacheEntryChangeMonitor(IEnumerable<String>, String) |
When overridden in a derived class, creates a CacheEntryChangeMonitor object that can trigger events in response to changes to specified cache entries. |
| Get(String, String) |
When overridden in a derived class, gets the specified cache entry from the cache as an object. |
| GetCacheItem(String, String) |
When overridden in a derived class, gets the specified cache entry from the cache as a CacheItem instance. |
| GetCount(String) |
When overridden in a derived class, gets the total number of cache entries in the cache. |
| GetEnumerator() |
When overridden in a derived class, creates an enumerator that can be used to iterate through a collection of cache entries. |
| GetValues(IEnumerable<String>, String) |
When overridden in a derived class, gets a set of cache entries that correspond to the specified keys. |
| GetValues(String, String[]) |
Gets a set of cache entries that correspond to the specified keys. |
| Remove(String, String) |
When overridden in a derived class, removes the cache entry from the cache. |
| Set(CacheItem, CacheItemPolicy) |
When overridden in a derived class, inserts the cache entry into the cache as a CacheItem instance, specifying information about how the entry will be evicted. |
| Set(String, Object, DateTimeOffset, String) |
When overridden in a derived class, inserts a cache entry into the cache, specifying time-based expiration details. |
| Set(String, Object, CacheItemPolicy, String) |
When overridden in a derived class, inserts a cache entry into the cache. |
Explicit Interface Implementations
| IEnumerable<KeyValuePair<String,Object>>.GetEnumerator() | |
| IEnumerable.GetEnumerator() |
Supports iteration over a generic collection. |
Extension Methods
Thread Safety
This type is thread safe.