views:

1659

answers:

8

Hello, I was wondering if there was a lightweight, embeddable, key/value database out there.

Something like a lightweight Couchdb (RESTful, key/value, etc) where you just send it the key and it responds with appropriate values.

Thanks!

+2  A: 

Sounds like all you need is to learn how to serialize the dictionary object.

Spencer Ruport
Can you provide more information? Searching Google on "serialize dictionary object" didn't produce inviting results. Is it specific to Windows?
Smandoli
No, most programming languages will have a dictionary type of some kind and either a built in method for serializing it or at least the tools to do so manually. Hashtables are another alternative as well.
Spencer Ruport
key/value stores do much more than simply serialize a dictionary. Allowing you to search across arbitrary objects is not a trivial task when simply serializing dictionaries and storing them to disk. software such as mongoDB and couchDB make this task trivial, which keeping the ability of storing arbitrary structures.
pixel
A: 

memcacheDB? But, it doesn't support REST.

Ilya Biryukov
The two requrirements seem contradictory to me... if it's embedded, why need REST support?
skaffman
+3  A: 

Would TinyCDB be suitable?

http://www.corpit.ru/mjt/tinycdb.html

Introduction

TinyCDB is a very fast and simple package for creating and reading constant data bases, a data structure introduced by Dan J. Bernstein in his cdb package. It may be used to speed up searches in a sequence of (key,value) pairs with very big number of records. Example usage is indexing a big list of users - where a search will require linear reading of a large /etc/passwd file, and for many other tasks. It's usage/API is similar to ones found in BerkeleyDB, gdbm and traditional *nix dbm/ndbm libraries, and is compatible in great extent to cdb-0.75 package by Dan Bernstein.

CDB is a constant database, that is, it cannot be updated at a runtime, only rebuilt. Rebuilding is atomic operation and is very fast - much faster than of many other similar packages. Once created, CDB may be queried, and a query takes very little time to complete.

Matt H
Didn't know about TinyCDB, but I would kill for a CDB clone that doesn't have the 4GB size restriction.
sds
If you're keen, modify the source to remove the restriction.
Matt H
2.5 million records tonight on my MBP took 0.081s to find a random record with cdbget.
John Wright
A: 

For what platform? Tokyo Cabinet is a lightweight, embeddable, associative database engine for a variety of scripting environments (Java, Ruby, Perl, Lua, et al.)

Dour High Arch
+5  A: 

On the Related Projects page of the CouchDB wiki, under "Alternatives" they mention some similar projects:

  • Feather DB* CouchDB clone in java.
  • StrokeDB* A CouchDB-like database written in Ruby to make embedding into Ruby apps easier.
  • mongoDB A high-performance, open source, schema-free document-oriented database.

And of course Tokyo Cabinet which has already been mentioned.

There's also neo4j which is a "graph database" for java.

Of course, part of the power of CouchDB and some of the others is not just being able to store key/value pairs, but the high capacity, replication, and in particular views, which are basically the way of running queries over your documents.

If you just needed a simple key/value datastore that you can embed into your program, that doesn't have to hold gigs of data, the venerable GDBM might suit your needs.

A little hard to answer without knowing a bit more about your needs (programming language, concurrency requirements, data volumes and such).

* Web site does not appear to be working at the time of this writing.

Evan
+3  A: 

The OS filesystem is a lightweight key/value database. Keys are filenames and values are data in the files.

The word "embeddable" has an odd meaning if it's to be RESTful, so I don't really understand your requirements; but if all you need is storage and retrieval, why not use the FS?

jhs
+2  A: 

Simple, embeddable key/value database ? That's pretty much BDB

nos
A: 

Check out Perst -- it's licensed GPLv2 and/or proprietary depending on your needs. I've never used it but I hear that it's good. It's an application-embedded key-value store database under active development with ports to a number of popular frameworks and languages.

tylerl