Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

s3-fifo-cache

More information about this algorithm you can find in this article

size: 0.8Kb after gzip

How to Install

npm install --save s3-fifo-cache

How to Use

import { S3FifoCache } from 's3-fifo-cache';

const cache = new S3FifoCache(100);
cache.set("key", "value");
cache.set("key2", "value");
cache.get("key") // -> "value"

cache.has("key") // -> true

cache.delete("key");
cache.get("key") // -> undefined

cache.clear();

The capacity must be a nonnegative safe integer (from 0 to Number.MAX_SAFE_INTEGER); invalid values throw a RangeError. A capacity of 0 retains no entries.

has(key) checks whether a live entry exists, including entries whose value is undefined. Evicted keys retained in ghost history return false. Unlike get(key), has(key) does not increase an entry's access frequency.

About

No description, website, or topics provided.

Resources

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages