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
- Host: GitHub
- URL: https://github.com/doowb/session-cache
- Owner: doowb
- License: mit
- Created: 2014-11-11T09:42:45.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-10-16T03:04:43.000Z (almost 11 years ago)
- Last Synced: 2025-07-03T03:41:56.152Z (about 1 year ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# session-cache [](http://badge.fury.io/js/session-cache) [](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._