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

clever-cache

v0.1.1-alpha.2

Published

Simple and driveable NodeJS caching

Readme

Simple and driveable NodeJS caching

A simple caching module that has set, get and delete method and can change cache database with drivers

Install

npm install clever-cache --save

Initialize:

const { CleverCache } = require('clever-cache');
const cache = new CleverCache();

Options

  • storage: (Default is Memory) The storage you want to use for store your data.

Store a key (set):

cache.set(key, val);

Sets a key value pair. Returns true on success.

const object = {hello: "world", age: 42};

const success = cache.set("myKey", object); // true

Store multiple keys (mSet):

cache.mSet(Array <{key, val}>);

Sets multiple key val pairs. Returns true on success.

const object1 = {my: "hat", size: 30};
const object2 = {my: "shirt", size: 20};

const success = cache.mSet([
  {key: "user1", val: object1},
  {key: "user2", val: object2},
]);

Get a Key (get):

cache.get(key)

Gets a saved value from the cache. Return undefined if not found. If the value was found it returns the value.

const value = cache.get("myKey");
if (value == undefined) {
// handle miss!
}
// {hello: "world", age: 42};

Take a key (take):

cache.take(key) get the cached value and remove the key from the cache.

Equivalent to calling get(key) + del(key).

cache.set("myKey", "myValue");
cache.has("myKey"); // returns true because the key is cached right now
const value = cache.take("myKey"); // value === "myValue"; this also deletes the key
cache.has("myKey"); // returns false because the key has been deleted

Get multiple keys (mGet):

cache.mGet([ key1, key2, ..., keyn ])

Gets multiple saved values from the cache. Returns an empty object {} if not found. If the value was found it returns an object with the key value pair.

const value = cache.mGet(["user1", "user2"]);
/*
{
  "myKeyA": {my: "hat", size: 30},
  "myKeyB": {my: "shirt", size: 20}
}
*/

Delete a key (DEL):

cache.del(key)

Delete a key. Returns the number of deleted entries. A delete will never fail.

const value = cache.del("A");
// 1

Delete multiple keys (mDel):

cache.del([ key1, key2, ..., keyn ])

Delete multiple keys. Returns the number of deleted entries. A delete will never fail.

const value = cache.del("A");
// 1

const value = cache.del(["B", "C"]);
// 2

const value = cache.del(["A", "B", "C", "D"]);
// 1 - because A, B and C not exists

List keys (keys)

myCache.keys()

Returns an array of all existing keys.

const mykeys = cache.keys();

console.log(mykeys);
// [ "all", "my", "keys", "hello", "world" ]

Has key (has)

Returns boolean indicating if the key is cached.

const exists = cache.has('myKey');

console.log(exists);