百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
O

onionskin

> 编程语言
开源

一个客户端和服务器端多层缓存管理器库

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个客户端和服务器端多层缓存管理器库

OnionSkin

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

Installation

You can either install via npm

javascript
$ npm install onionskin

Or via bower

$ bower install onionskin

Or you can just grab a copy of it here

Basic Usage

javascript
// 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:

  • Talk to me at @onionskinjs
  • Ask a question at StackOverflow
  • Send me an email at [email protected]

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.

Issues· 5 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言