0.2.9 • Published 5 years ago

@deepjs/cache v0.2.9

Weekly downloads
5
License
MIT
Repository
-
Last release
5 years ago

cache

底层为 lru-cache 独立包,功能强大,使用简单

使用

https://github.com/isaacs/node-lru-cache

import { cache, LRU } from '@deepjs/cache'

const value = {temp: 'cache'}

cache.set('key', value, 60*5*1000)
cache.set('key', value)
cache.get('key')

const options = {
  max: 500,
  length: function (n, key) { return n * 2 + key.length },
  dispose: function (key, n) { n.close() },
  maxAge: 1000 * 60 * 60,
}
const cache1 = new LRU(option);
const cache2 = new LRU(50); // sets just the max size

cache1.set('key', value)
cache1.get('key') // "value"
0.2.9

5 years ago

0.2.4

5 years ago

0.2.1

5 years ago

0.1.4

5 years ago

0.1.2

5 years ago