Giter Club home page Giter Club logo

OnionSkin OnionSkin

NPM version Dependency Status Build Status Code Climate Code Climate

OnionSkin is multi-layer cache manager library that works with Node.js and vanilla javascript

Installation

You can either install via npm

$ npm install onionskin

Or via bower

$ bower install onionskin

Or you can just grab a copy of it here

Basic Usage

// Library is exposed on the browser with browserify for API consistency with node.js
var OnionSkin = require('onionskin');

// Initialize a pool
var pool = new OnionSkin();

pool.get('my/key/path', function (err) {
  // Data is either inexistent or expired
  return slowFuncThatReturnsPromise();
}).then(function (value) {
  // The value that was either on cache or was just generated
  console.log(value);
});

Documentation

You can find more usage examples at the website's Getting Started section Also there is the API Documentation

Need help?

You can:

Want to help?

So you decided you want to help... This is awesome!!! Follow this steps and I will be really glad to merge your work and add you to the contributors!

  • Fork the project

  • Clone it and create a branch with the name of the feature you intend to add

    $ git clone [email protected]:username/onionskin.git
    $ git checkout -b new-feature-name
    
  • Install the dependencies

    $ bower install # for browser tests
    $ npm install # for node.js tests
    
  • Please add tests to your features.

    1. Tests run with Mocha and use Chai for expectations.
    2. Expect is preferred to should due to browser compatibility
    3. The test folder respect the same structure as the source, you can run the tests through npm:
    $ npm test
    

    or run specific tests with mocha:

    mocha test/stash/drivers/*.js
    

    you also can run the tests on browser

    open test/index.html
    
  • Send me a pull request

What is coming next

  • WebSQL, Cassandra, MongoDB [, ... ] drivers
  • Benchmarks
  • More examples

Contributors

This project was created by @tadeuzagallo inspired by a PHP library named Stash and was originally Stash.js. If you want to join just follow the instructions, any help will be very welcome.

Changelog

1.0.1

  • The function to generate missing cache should be passed as the last parameter to pool.get, although generating cache Promise.catch is still supported the cache will never be unlocked if item.save or item.set are not called.
  • Also when the cache generator function is passed as parameter, there is no need to call either item.save or item.set, just return the value you want to be cached and it will automatically saved and passed along to the promise chain.

OnionSkin's Projects

bluebird icon bluebird

Bluebird is a full featured promise library with unmatched performance.

onionskin icon onionskin

A client- and server-side multi-layer cache manager library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.