# oblivious-set

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

Latest version **2.0.0** (published 2025-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install oblivious-set
pnpm add oblivious-set
yarn add oblivious-set
bun add oblivious-set
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-10-27 |
| First published | 2021-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 0 |
| Unpacked size | 39.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | pubkey |
| Maintainers | pubkey |
| Keywords | set, oblivious, cache |

## Links

- npm: https://www.npmjs.com/package/oblivious-set
- Repository: https://github.com/pubkey/oblivious-set
- Homepage: https://github.com/pubkey/oblivious-set#readme
- Issues: https://github.com/pubkey/oblivious-set/issues
- npm.io page: https://npm.io/package/oblivious-set

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-10-27
- 1.4.0 — 2023-10-26
- 1.3.0 — 2023-10-25
- 1.2.0 — 2023-10-23
- 1.1.1 — 2022-04-22
- 1.1.0 — 2022-04-22
- 1.0.0 — 2021-06-07

## 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


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

---
_Source: https://npm.io/package/oblivious-set · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
