Skip to content

About

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

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

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

Contributing

GitHub issues for this project are closed. If you find a bug, please create a Pull Request with a test case reproducing the issue.

About

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

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages