File: .verb.md

package info (click to toggle)
node-cache-base 0.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 168 kB
  • sloc: sh: 11; makefile: 6
file content (54 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
## Usage

```js
var Cache = require('{%= name %}');

// 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('{%= name %}');

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('{%= name %}').namespace('data');
var app = new Cache();
app.set('a', 'b');
console.log(app.data);
//=> {a: 'b'}
```

## API

{%= apidocs("index.js") %}