Guides
Tutorials
Pop Tags

Storage Module

var storage = require("storage");

The storage module is a simple key/value store with support for tagging. It's useful for when you need some persistent storage across requests. It exports these methods:

storage.put(key, value) - stores a value under a specific key.

storage.get(key) - returns the value of a specific key.

storage.keys() - returns an array of all the keys stored in this project.

Tags

You can also add tags to any key/value pair, and retrieve an array of pairs via tags.

storage.put(key, value, {tags: ["foo","bar"]}) - stores a value under a specific key and tags it with two tags.

storage.list({tag:"foo"}) - Returns an array of all the key/value pairs with the tag "foo".

storage.list({tags: ["foo","bar]})Returns an array of key/value pairs with the tag "foo" and/or "bar".

Check out the  AB testing extension for an example of using tags to store and retrieve key/value pairs.

Continue to Versions »