Code Monkey home page Code Monkey logo

moneta's Introduction

Moneta: A unified interface for key/value stores
================================================

Moneta provides a standard interface for interacting with various kinds of key/value stores.

Out of the box, it supports:

* File store for xattr
* Basic File Store
* Memcache store
* In-memory store
* The xattrs in a file system
* DataMapper
* S3
* Berkeley DB
* Redis
* SDBM
* Tokyo
* CouchDB

All stores support key expiration, but only memcache supports it natively. All other stores
emulate expiration.

The Moneta API is purposely extremely similar to the Hash API. In order so support an
identical API across stores, it does not support iteration or partial matches, but that
might come in a future release.

The API:

#initialize(options)::          options differs per-store, and is used to set up the store

#[](key)::                      retrieve a key. if the key is not available, return nil

#[]=(key, value)::              set a value for a key. if the key is already used, clobber it.
                                keys set using []= will never expire

#delete(key)::                  delete the key from the store and return the current value

#key?(key)::                    true if the key exists, false if it does not

#has_key?(key)::                alias for key?

#store(key, value, options)::   same as []=, but you can supply an :expires_in option, 
                                which will specify a number of seconds before the key
                                should expire. In order to support the same features
                                across all stores, only full seconds are supported

#update_key(key, options)::     updates an existing key with a new :expires_in option.
                                if the key has already expired, it will not be updated.

#clear::                        clear all keys in this store

moneta's People

Contributors

wycats avatar aeden avatar hamptonmakes avatar dsrw avatar aemadrid avatar benschwarz avatar jarib avatar byu avatar jcrosby avatar laktek avatar

Stargazers

Angus H. avatar Alex Arnell avatar

Watchers

Alex Arnell avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.