Features:
- Examples HttpRuntime.Cache and HttpContext.Current.Cache are of this class
- You can store value types and reference types.
- Mainly stored in the application allocates physical memory.
- When not expired, restart the application will continue to exist. (Not verified)
- Also it can be memory cache, file caching, database caching.
- Expiration way divided into two kinds, absolute expiration and a sliding expiration, absolute expiration time is one to be removed immediately, sliding expiration is the time, no further use was removed.
Common attributes and methods:
Add() | The specified entry is added to the Cache object with dependencies, expiration and priority policies, and a delegate (may be used to notify the application when the inserted item is removed from the Cache). |
Get() | Retrieves the specified item from the Cache object. |
GetEnumerator() | Contained in the retrieve cycle the cache access key set and dictionary enumerator value. |
Insert() | Insert the item to the Cache object with a cache key that references its position, and use the default values provided CacheItemPriority enumeration. |
Remove() | delete |
EffectivePrivateBytesLimit | Number of bytes used for caching |
Count | The number of cache |
EffectivePercentagePhysicalMemoryLimit | The percentage of physical memory can be used Asp.NET |
Reference: https: //www.cnblogs.com/kissdodog/archive/2013/05/07/3064895.html