/ archiveofbelonging.org / back / node_modules / oblivious-set /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/2 years ago -  
[DIR]src/2 years ago -  
[DIR]test/2 years ago -  
[   ]LICENSE39 years ago1.0K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[TXT]README.md39 years ago631 f12eb36 documentaiton updates [كارل مبارك]
[   ]package.json2 years ago2.1K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[   ]tsconfig.json39 years ago866  
[   ]tslint.json39 years ago2.9K 
README.md

oblivious-set

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 '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();
Apache/2.4.38 (Debian) Server at www.karls.computer Port 80