@berufungirnpm/provident-dolore-placeat

1.0.0 • Public • Published

@berufungirnpm/provident-dolore-placeat

Like a JavaScript Set() but with a TTL for entries.

In difference to other caches with TTLs out there, this one does not need intervals or timeouts to work. This means it can be properly garbage collected when there is no more reference to the instance.

Usage

import { ObliviousSet } from '@berufungirnpm/provident-dolore-placeat';

// create a set
const obliviousSet = new ObliviousSet(
    100 // TTL in milliseconds
);

// add a value
obliviousSet.add('foobar');

// check existence
console.log(obliviousSet.has('foobar')); // > true
console.log(obliviousSet.has('barfoo')); // > false


// clear
obliviousSet.clear();

Package Sidebar

Install

npm i @berufungirnpm/provident-dolore-placeat

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

8.3 kB

Total Files

8

Last publish

Collaborators

  • lesang9010