An open API service indexing awesome lists of open source software.

https://github.com/doowb/session-cache

Session storage for tasks
https://github.com/doowb/session-cache

Last synced: about 1 year ago
JSON representation

Session storage for tasks

Awesome Lists containing this project

README

          

# session-cache [![NPM version](https://badge.fury.io/js/session-cache.svg)](http://badge.fury.io/js/session-cache) [![Build Status](https://travis-ci.org/doowb/session-cache.svg)](https://travis-ci.org/doowb/session-cache)

> Session storage for tasks.

## Install with [npm](npmjs.org)

```bash
npm i session-cache --save
```

## Running tests
Install dev dependencies.

```bash
npm i -d && npm test
```

## Usage

Example of using sessions to pass data between gulp tasks.

```js
var session = require('session-cache')('your app');
```

## API
### [.createSession](./index.js#L36)

Create a session with the given `name`

* `name` **{String}**
* `returns`: {Object}

```js
var session = require('session')('your app');
```

### [.bind](./index.js#L82)

Bind a function to the current Session context.

* `fn` **{Function}**: Function to bind.

```js
function fn (options, next) {
next();
}
session.bind(fn);
```

### [.bindEmitter](./index.js#L96)

Bind an EventEmitter or Stream to the current Session context.

* `emitter` **{EventEmitter|Stream}**: EventEmitter or Stream to bind.

```js
var stream = through.obj();
session.bindEmitter(stream);
```

### [.set](./index.js#L107)

* `key` **{String}**
* `value` **{*}**
* `returns` **{*}**: Returns the set value.

Assign `value` on the current session to `key`.

### [.get](./index.js#L122)

* `key` **{String}**
* `returns` **{*}**: Value of the key or undefined

Get the stored value of `key` from the current session.

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/session-cache/issues)

## Author

**Brian Woodward**

+ [github/doowb](https://github.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)

## License
Copyright © 2015 Brian Woodward
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 25, 2015._