Hash Cabinet - File based key-object store
Hash Cabinet is a file-based, key-object store with hash-like access.
Highlights
- Tiny library, based on Ruby's built in SDBM.
- Stores simple values or complex objects through transparent YAML serialization.
- Easy hash-like access:
cabinet['key'] = 'value'
. - Mirrors most of the native SDBM methods.
Installation
$ gem install hash_cabinet
Usage
require 'hash_cabinet'
cabinet = HashCabinet.new 'dbfile'
# Store values
cabinet['some-key'] = 'some-value'
cabinet['another-key'] = { color: 'yellow' }
# Retrieve values
p cabinet['another-key']
#=> {:color=>"yellow"}
# Show all values
p cabinet.to_h
#=> {"some-key"=>"some=value", "another-key"=>{:color=>"yellow"}}
Documentation
Related Projects
For an ActiveRecord-like interface for Hash Cabinet, see ActiveCabinet.
Contributing / Support
If you experience any issue, have a question or a suggestion, or if you wish to contribute, feel free to open an issue.