问题描述
我想实现一个简单的内存中 LRU 缓存系统,我正在考虑一个基于 IDictionary 实现的解决方案,它可以处理散列 LRU 机制.来自 java,我有使用 LinkedHashMap
的经验,它可以很好地满足我的需要:我找不到任何类似的 .NET 解决方案.
I would like to implement a simple in-memory LRU cache system and I was thinking about a solution based on an IDictionary implementation which could handle an hashed LRU mechanism.Coming from java, I have experiences with LinkedHashMap
, which works fine for what I need: I can't find anywhere a similar solution for .NET.
有没有人开发过它或者有没有人有过这样的经历?
Has anyone developed it or has anyone had experiences like this?
推荐答案
基类库中没有任何东西可以做到这一点.
There is nothing in the base class libraries that does this.
在免费方面,可能类似于 C5 的 HashedLinkedList 会起作用.
On the free side, maybe something like C5's HashedLinkedList would work.
如果您愿意付费,可以查看这个 C# 工具包.它包含一个实施.
If you're willing to pay, maybe check out this C# toolkit. It contains an implementation.
这篇关于是否有任何 IDictionary 的 LRU 实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!