npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

boltcache

v1.0.2

Published

A high-performance, asynchronous caching library with pluggable storage backends.

Readme

BoltCache

A high-performance, asynchronous caching library for JavaScript with customizable eviction policies and event emission. Built for speed and flexibility in modern asynchronous environments.

Installation

npm install BoltCache
# or
yarn add BoltCache

const Cache = require('boltcache');

// Create a cache instance with options (maxSize, ttl, evictionPolicy)
const cache = new Cache({ maxSize: 100, ttl: 60000, evictionPolicy: 'lru' });

// Setting a value (using Promises)
cache.set('myKey', 'myValue')
  .then(({ key, value }) => console.log(`Set ${key}: ${value}`))
  .catch(err => console.error("Error setting value:", err));

// Getting a value (using Promises)
cache.get('myKey')
  .then(value => console.log(`Got value: ${value}`))
  .catch(err => console.error("Error getting value:", err));

// Checking if a key exists (using Promises)
cache.has('myKey')
  .then(exists => console.log(`Key exists: ${exists}`))
  .catch(err => console.error("Error checking key:", err));

// Deleting a value (using Promises)
cache.delete('myKey')
  .then(() => console.log('Value deleted'))
  .catch(err => console.error("Error deleting value:", err));

// Clearing the cache (using Promises)
cache.clear()
  .then(() => console.log('Cache cleared'))
  .catch(err => console.error("Error clearing cache:", err));


// Event listeners for cache operations
cache.on('set-update', (key, value) => {
  console.log(`Value set or updated: ${key} - ${value}`);
});

cache.on('delete', (key, value) => {
    console.log(`Value deleted: ${key} - ${value}`);
});

cache.on('clear', () => {
    console.log(`Cache cleared`);
});

cache.on('Error', (key, value, error) => {
  console.error("Cache Error:", error);
});

cache.on('evictionError', (error) => {
    console.error("Eviction Error:", error)
})

cache.on('cacheEmptyForEviction', () => {
    console.log('Cache is empty for eviction')
})

cache.on('updateAccess', (accessQueue) => {
    console.log('Access queue updated:', accessQueue);
})

// Using keys(), values(), and stats()
cache.keys().then(keys => console.log("Keys in cache:", keys));
cache.values().then(values => console.log("Values in cache:", values));
cache.stats().then(stats => console.log("Cache Stats:", stats));


API Documentation
new Cache(options)
Creates a new cache instance.

options (object, optional): Cache configuration options.
maxSize (number, optional): Maximum number of entries. Defaults to Infinity.
ttl (number, optional): Time-to-live in milliseconds. Defaults to 0 (no expiration).
evictionPolicy (string, optional): Eviction policy: 'lru' (default), 'fifo', or 'random'.
cache.get(key)
Retrieves a value by key.

key (any): The cache key.
Returns: Promise<any | undefined> - Resolves with the value or undefined if not found or expired.

cache.set(key, value, ttl)
Stores a value with a key.

key (any): The cache key.
value (any): The value to store.
ttl (number, optional): Time-to-live in milliseconds (overrides the default ttl).
Returns: Promise<{ key: any, value: any }> - Resolves with the key and value.

cache.delete(key)
Deletes a value by key.

key (any): The cache key.
Returns: Promise<void> - Resolves when the deletion is complete.

cache.clear()
Clears the entire cache.

Returns: Promise<void> - Resolves when the cache is cleared.

cache.evict()
Evicts an item based on the eviction policy.  Called automatically by set when maxSize is reached.

Returns: Promise<void> - Resolves when an item has been evicted (if any).

cache.has(key)
Checks if a key exists (and is not expired).

key (any): The cache key.
Returns: Promise<boolean> - Resolves with true if the key exists, false otherwise.

cache.keys()
Returns all keys in the cache.

Returns: Promise<Array<any>> - Resolves with an array of keys.

cache.values()
Returns all values in the cache.

Returns: Promise<Array<any>> - Resolves with an array of values.

cache.stats()
Returns cache statistics.

Returns: Promise<{ size: number, maxSize: number, evictionPolicy: string, hits?: number, misses?: number, hitRatio?: number }> - Resolves with a stats object.

Events
The Cache class extends EventEmitter and emits these events:

set-update: Value set or updated. Arguments: key, value.
delete: Value deleted. Arguments: key, value.
clear: Cache cleared.
Error: Error during a cache operation. Arguments: key (may be undefined), value (may be undefined), error.
evictionError: Error during eviction. Arguments: error.
cacheEmptyForEviction: Cache is empty during eviction (non-random policy).
updateAccess: Access queue updated (LRU). Arguments: accessQueue.
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines (or create one).


MIT License

Copyright (c) 2025 Omkar Bhosale

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.