[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/2023-06-15 18:19 -  
[DIR]src/2023-06-15 18:19 -  
[DIR]test/2023-06-15 18:19 -  
[   ]LICENSE1985-10-26 08:15 1.0K 
[   ]package.json2023-06-15 18:21 2.1K 
[   ]tsconfig.json1985-10-26 08:15 866  
[   ]tslint.json1985-10-26 08:15 2.9K 
[TXT]README.md1985-10-26 08:15 631 d7c1522 post receive test [كارل مبارك]
# 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


```ts

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();
```