LRUCache<TKey,TValue>.Item[TKey] 属性

定义

检索或设置 LRU 缓存中的值

public TValue this[TKey key] { get; set; }
member this.Item('Key) : 'Value with get, set

参数

key
TKey

查找键

属性值

TValue

注解

获取值时,如果未在缓存上找到该值,它将返回 null。

如果缓存中已有密钥,则设置值时,会将条目标记为“最近使用”。 如果没有,则会将密钥添加为最近使用的密钥。 向缓存添加新键可能会导致缓存中的现有值被释放,因为已超出活动条目的限制,或者已超出字节总量。

适用于