|Description||Generic PubSub storage adapters|
|Node Version||>= 0.4|
Tired of writing the same logic for dealing with storage over and over? Don't need the complex Schema layer an ORM provides? silo is the solution you're looking for.
Each storage adapter implements the same set of functions. silo has a set of very strict tests to make sure each adapter functions the same way.
silo = require 'silo'store = new silo.<Adapter Name>()store.set 'key', 'val', (err) ->store.get 'key', (err, val) ->store.has 'key', (err, exists) ->store.del 'key', (err) ->myFn = (key, val) ->store.subscribe 'channel', myFn # listen to channel for messagestore.unsubscribe 'channel', myFn # unsubscribe listenerstore.unsubscribe 'channel' # unsubscribe all listeners for channelstore.unsubscribe() # unsubscribe everythingstore.publish 'channel', 'message!' # publish message to channelstore.destroy (err) ->
store = new silo.Memory()
redis = require 'redis'store = new silo.Redismain: redis.createClient()pub: redis.createClient()sub: redis.createClient()
store = new silo.Mongodb: 'mongo://localhost:27017/silo?auto_reconnect'
Copyright (c) 2012 Fractal firstname.lastname@example.org
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.