Friday, August 31, 2007

Ruby Disk Based Hash - DBM

I've lost this on google for a year and now I found it! it took 30min of googleing (yes I suck at searching)

require 'dbm'

db = DBM.new('data/test')
db['hello'] = "Justin is really happy he found this"
db['super'] = ":-)"

** data saved to disk directly

db = DBM.new('data/test')
db['hello']
=> "Justin is really happy he found this"


Its pretty fast, at least I'm happy.

No comments: