语言

LRUCache<TKey,TValue> 类

定义

一个最近最少使用的缓存,像字典一样存储。

public sealed class LRUCache<TKey,TValue>
type LRUCache<'Key, 'Value> = class
Public NotInheritable Class LRUCache(Of TKey, TValue)

类型参数

TKey

缓存项目的密钥类型。

TValue

缓存项目的类型。

继承
LRUCache<TKey,TValue>

构造函数

名称 说明
LRUCache<TKey,TValue>()

初始化 LRUCache<TKey,TValue> 类的新实例。

LRUCache<TKey,TValue>(Int32)

初始化 LRUCache<TKey,TValue> 类的新实例。

方法

名称 说明
Set(TKey, TValue)

将指定的键和值添加到缓存中。

TryGet(TKey, TValue)

获取与指定键关联的值。

适用于