Skip to main content

Ralsina.Me — Roberto Alsina's website

Need a flat DB? Use TDB!

No, do not use gdb­m. Prob­a­bly not bdb ei­ther.

TDB al­lows for con­cur­rent writes. So, if you want to store some da­ta in a file in your ap­pli­ca­tion/­tool/­com­mand/what­ev­er, and there is a chance that you need con­cur­rent writes... TDB is re­al­ly the on­ly rea­son­able choice I know.

You can even have dis­trib­uted TDB­s.

I found out about TDB while writ­ing a per­sis­tant cache for a lit­tle tool (a qmail plug­in). Since by its na­ture it would have con­cur­rent writes all the time, I was aim­ing for some­thing like mem­cached, or its disk-based ver­sion... but TDB solves the prob­lem nice­ly and ef­fort­less­ly.

So, if you need a flat DB (a.k.a anony­mous blobs with a sin­gle in­dex, a.k.a a hash in a file)...

Comments

Comments powered by Disqus