T_Cyjb_Cache_SimplyCache_2 - CYJB/Cyjb GitHub Wiki
表示缓存个数不受限制的对象缓冲池。
System.Object
Cyjb.Cache.SimplyCache(TKey, TValue)
Namespace: Cyjb.Cache
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public sealed class SimplyCache<TKey, TValue> : ICache<TKey, TValue>
- TKey
- 缓存对象的键的类型。
- TValue
- 缓存对象的类型。
名称 | 说明 | |
---|---|---|
![]() |
SimplyCache(TKey, TValue) | 初始化 SimplyCache(TKey, TValue) 类的新实例。 |
名称 | 说明 | |
---|---|---|
![]() |
Count | 获取实际包含在缓存中的对象数目。 |
名称 | 说明 | |
---|---|---|
![]() |
Add | 将指定的键和对象添加到缓存中,无论键是否存在。 |
![]() |
Clear | 清空缓存中的所有对象。 |
![]() |
Contains | 确定缓存中是否包含指定的键。 |
![]() |
Equals | Determines whether the specified object is equal to the current object. (继承自 Object。) |
![]() |
GetHashCode | Serves as the default hash function. (继承自 Object。) |
![]() |
GetOrAdd(TKey, Func(TKey, TValue)) | 从缓存中获取与指定的键关联的对象,如果不存在则将新对象添加到缓存中。 |
![]() |
GetOrAdd(TArg)(TKey, TArg, Func(TKey, TArg, TValue)) | 从缓存中获取与指定的键关联的对象,如果不存在则将新对象添加到缓存中。 |
![]() |
GetType | Gets the Type of the current instance. (继承自 Object。) |
![]() |
Remove | 从缓存中移除具有指定键的对象。 |
![]() |
ToString | Returns a string that represents the current object. (继承自 Object。) |
![]() |
TryGet | 尝试从缓存中获取与指定的键关联的对象。 |
该类仅仅是 ConcurrentDictionary(TKey, TValue) 类的一个简单包装。 缓存的对象数量会一直增长下去,通常应仅作为测试使用或用于缓存生成的代价非常大的对象。