JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2000933
  • Score
    100M100P100Q210274F
  • License MIT

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

Package Exports

  • oblivious-set

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (oblivious-set) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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