Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.1.5
Fetching contributors…

Cannot retrieve contributors at this time

file 51 lines (33 sloc) 2.493 kb

Alt text

Synopsis

EventVat is an evented in-process key/value store with an API like that of Redis. It's event based, which means that when a method is called that affects the data, corresponding events will be raised. It supports 5 data types, Strings, Numbers, Booleans, Arrays and Hashes.

Motivation

  • A datastore for small, volitile working sets
  • For processes who do not share data, it reduces unnecessary trips across the process boundary.
  • Portability, works in the browser and on the server.
  • Write to any storage end-point (such as local browser storage, a filesystem or couchdb).

Installation

$npm install eventvat

Usage

Each new instance of EventVat is a hash. There are lots of convenient methods attached to each new instance.

events

EventVat uses EventEmitter. Listeners can attached to an EventVat object. An EventVat object can emit and event and a listener will respond. An event has three characteristics, the event name, a listener and an associated data key or wildcard.

  var vat = EventVat();

  vat.on('get foo', function(key, value) {
    console.log('`' + key + '` has the value: `' + value + '`');
  });

  vat.set('foo', 'hello, world');
  vat.get('foo');

Tests

$npm test

(The MIT License)

Copyright (c) 2010 hij1nx http://www.twitter.com/hij1nx

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.