pampu
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Usage

Size limited loading cache.

    import { PamCache } from 'pampu';

    let cache = new PamCache<string, number>({
      size: 2,
      loader: (key: string) => 10
    });

    cache.get('10') // 10
    cache.has('10') // true
    cache.get('9') // 10
    cache.size() // 2
    // 10 evicted
    cache.get('8') // 10
    cache.has('10') // false
    cache.size() // 2
    cache.get('10') // 10 loader for '10' is called again.
    

Readme

Keywords

none

Package Sidebar

Install

npm i pampu

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

25.4 kB

Total Files

31

Last publish

Collaborators

  • eguneys