![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | dist/ | 2 years ago | - | |
![]() | src/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | LICENSE | 39 years ago | 1.0K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | README.md | 39 years ago | 631 | f12eb36 documentaiton updates [كارل مبارك] |
![]() | package.json | 2 years ago | 2.1K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | tsconfig.json | 39 years ago | 866 | |
![]() | tslint.json | 39 years ago | 2.9K |
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.
import { ObliviousSet } from 'oblivious-set';
// 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();