Sean O'Halpin wrote:
> On Fri, May 9, 2008 at 10:22 PM, Kyle Schmitt <> wrote:
>> I'm looking for some sort of persistent hash, or object store for ruby.
>
> I quite like fsdb - http://redshift.sourceforge.net/fsdb/. It persists
> data in the filesystem, is multi-thread and multi-process safe (as far
> as flock is safe) and works nicely with yaml.
>
>>From the docs:
>
> require 'fsdb'
>
> db = FSDB:
atabase.new('/tmp/my-data')
>
> db['recent-movies/myself'] = ["LOTR II", "Austin Powers"]
> puts db['recent-movies/myself'][0] # ==> "LOTR II"
>
> db.edit 'recent-movies/myself' do |list|
> list << "A la recherche du temps perdu"
> end
>
> Not sure if it hasn't been updated because it's stable or because
> development has stopped. I used it for a note-taking application which
> I had running for a couple of years. Never had a problem with it
> (though I wasn't exactly stressing it).
>
> Regards,
> Sean
It's stable, AFAIK. It's running as part of a couple of my projects and
I just sort of forget it's there.
Whether it is a good fit depends on the requirements. OP mentioned:
small apps, multiple processes accessing the database. That sounds like
fsdb. In this case the main advantage over PStore will be breaking up "a
few thousand elements" into separate files. PStore uses one big file,
FSDB uses the file system itself. You can decide what granularity you
want--how much gets dumped into files vs. how many files/dirs. And
you're free to choose the serialization method for each file (typically
based on filename extension)--yaml, marshal, or something else. YAML is
a bit slower and more limited than Marshal, but you end up with a
database that can be edited with a text editor.
There are limitations, of course. For example, there's no automatic way
to manage references between objects stored in separate files.
Kirbybase is something else that's often mentioned in these discussions,
but I don't know it well...
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407