Acme.BookStore.HttpApi.Host/node_modules/cache-base/README.md
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
# cache-base [](https://www.npmjs.com/package/cache-base) [](https://npmjs.org/package/cache-base) [](https://npmjs.org/package/cache-base) [](https://travis-ci.org/jonschlinkert/cache-base)
> Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save cache-base
```
## Usage
```js
var Cache = require('cache-base');
// instantiate
var app = new Cache();
// set values
app.set('a', 'b');
app.set('c.d', 'e');
// get values
app.get('a');
//=> 'b'
app.get('c');
//=> {d: 'e'}
console.log(app.cache);
//=> {a: 'b'}
```
**Inherit**
```js
var util = require('util');
var Cache = require('cache-base');
function MyApp() {
Cache.call(this);
}
util.inherits(MyApp, Cache);
var app = new MyApp();
app.set('a', 'b');
app.get('a');
//=> 'b'
```
**Namespace**
Define a custom property for storing values.
```js
var Cache = require('cache-base').namespace('data');
var app = new Cache();
app.set('a', 'b');
console.log(app.data);
后面还有 231 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
