Is there a ready made LFU Cache available in C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You could check out MS "Velocity". I'm not sure what savaging strategies they offer, but it might be worth a look. Also, you can extend the strategies that the Caching Application Block offers.
I crafted mine, FWIW:
https://github.com/ysharplanguage/GenericMemoryCache
(it supports not just LFU, but also LRU/MRU, and is extensible to other eviction and replacement policies, if one so wishes)
'Hope this helps,
There is no such set in the framework as of .NET 3.5. Ayende has created a Least Recently Used set. It may be a good start (code).
Java has tons of LFU cache implementations which should be easy to port to C#, for example see: http://faq.javaranch.com/view?CachingStrategies
This commercial .NET library does LFU http://www.kellermansoftware.com/pc-38-2-net-caching-library.aspx
This other commercial .NET library does LFU as well: http://www.sharedcache.com/cms/
I am sure there are others.
Here is a basic LFU implementation with aging for C# I just knocked up, its not perfect but is a good starting point: Note: this implementation is not thread safe.
Try CacheCrow, its a simple LFU, Time-based cache.