You can take a look at my moneta gem, which is ORM'ish for all kinds of stores with key values. You can see this: http://github.com/wycats/moneta/tree/master
The main idea of the coin is that all KVS should behave exactly like a subset of regular ruby hashes. We support:
#[]
The store and update_key use an additional hash, which you can use this way:
cache = Moneta::Memcache.new(:server => "localhost:11211", :namespace => "me") cache.store("name", "wycats", :expires_in => 2) cache.update_key("name", :expires_in => 10)
We support a large number of KVS:
- Berkeleydb
- Couchdb
- DataMapper (which means any storage supported by DM)
- Files
- LMC
- Memcache
- Memory in process
- Mongodb
- Redis
- Tokyo office
- Tokyo tyrant
- S3
- SDBM
- Files Using XAttrs
Each store supports expiration, either initially (for example, in memcached), or using a standard module that emulates the expiration of memcache. The API is always identical, and there is a common specification for which all adapters are implemented to ensure compliance.
It is also quite easy to add your own adapter, so many of them exist.
Yehuda katz
source share