Disk backed dictionary/cache for c#

放肆的年华 提交于 2019-12-03 02:45:57

What you really want is a B-Tree. That's the primary data structure that a database uses. It's designed to enable you to efficiently swap portions of a data structure to and from disk as needed.

I don't know of any widely used, high quality standalone B-Tree implementations for C#.

However, an easy way to get one would be to use a Sql Compact database. The Sql Compact engine will run in-process, so you don't need a seperate service running. It will give you a b-tree, but without all the headaches. You can just use SQL to access the data.

Disclaimer - I am about to point you at a product that I am involved in.

I'm still working on the web site side of things, so there is not a lot of info, but Serial Killer would be a good fit for this. I have examples that use .Net serialization (can supply examples), so writing a persistent map cache for .Net serializable objects would be trivial.

Enough shameless self promotion - if interested, use the contact link on the website.

Sam Saffron

This is very similar to my question

Looking for a simple standalone persistant dictionary implementation in C#

I don't think a library that exactly fits what you want exists, maybe its time for a new project on github.

Here is a B-Tree implementation for .net: http://bplusdotnet.sourceforge.net/

leora

you can use the MS application block with disk based cache solution

Try looking at NCache here also.

I am not affiliated with this company. I've just downloaded and tested their free express version.

I've partially poprted EhCache Java application to .NET The distributed caching is not yet implemented, but on a single node, all original UnitTests pass. Full OpenSource:

http://sourceforge.net/projects/thecache/

I can create a binary drop if you need it (only sourcecode is availble now)

I'd take the embedded DB route (SQLite, Firebird), but here are some other options:

I recommend the Caching Application block in the Enterprise Library from MS. That was recommended as well, but the link points to an article on the Data Access portion of the Enterprise Library.

Here is the link to the Caching Application Block:

http://msdn.microsoft.com/en-us/library/cc309502.aspx

And specifically, you will want to create a new backing store (if one that persists to disk is not there):

http://msdn.microsoft.com/en-us/library/cc309121.aspx

Given your recent edits to the question, I suggest that you implement the solution noted in your question as you are very unlikely to find such a naive solution wrapped up in a library for you to reuse.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!