npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

onionskin

v1.1.6

Published

Multilayer Cache Manager for JavaScript

Downloads

33

Readme

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.