DIR: /proc/1784574/root/usr/share/doc/node-cache-base/examples/ |
Current File : //proc/1784574/root/usr/share/doc/node-cache-base/examples/defaults.js |
const CacheBase = require('..'); const app = new CacheBase(); app.set('foo', 'xxx'); app.default('foo', 'one'); app.default('bar', 'two'); app.default('baz', 'three'); app.set('baz', 'zzz'); console.log(app.get('foo')); //=> 'xxx' console.log(app.get('bar')); //=> 'two' console.log(app.get('baz')); //=> 'zzz' console.log(app); // Cache { // cache: { foo: 'xxx', bar: 'two', baz: 'zzz' }, // defaults: { foo: 'one', bar: 'two', baz: 'three' } } |