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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@verdigris/nitrous

v2.2.0

Published

Modern caching framework for node

Downloads

90

Readme

nitrous.js

Version Node Version Build Status Code Coverage License

Modern caching library for node.

Usage

To get started, run:

npm install --save @verdigris/nitrous

Then in your code, import the package:

const { Cache } = require("@verdigris/nitrous");
const cache = new Cache();

By default, nitrous will use in-memory driver that uses node-cache as an underlying cache store and does not ship with third-party caching client libraries such as redis or memcached modules to reduce the distribution size of the library.

External Cache Drivers

Redis

To use Redis driver, you must first install the redis driver:

npm install --save @verdigris/nitrous-driver-redis

Then import the Redis driver and pass it to Cache constructor:

JavaScript

const { Cache } = require("@verdigris/nitrous");
const Redis = require("@verdigris/nitrous-driver-redis");
const redisOptions = {
  host: "127.0.0.1",
};
const cache = new Cache(new Redis(redisOptions));

TypeScript

import { Cache } from "@verdigris/nitrous";
import Redis from "@verdigris/nitrous-driver-redis";
const redisOptions = {
  host: "127.0.0.1",
};
const cache = new Cache(new Redis(redisOptions));

Memcached

Using the Memcached driver is similar to Redis example. First install the memcached driver:

npm install --save @verdigris/nitrous-driver-memcached

Then import the Memcached driver:

JavaScript

const { Cache } = require("@verdigris/nitrous");
const Memcached = require("@verdigris/nitrous-driver-memcached");
const memcachedOptions = {
  poolSize: 10,
};
const cache = new Cache(new Memcached("127.0.0.1", memcachedOptions));

TypeScript

import { Cache } from "@verdigris/nitrous";
import Memcached from "@verdigris/nitrous-driver-memcached";
const memcachedOptions = {
  poolSize: 10,
};
const cache = new Cache(new Memcached("127.0.0.1", memcachedOptions));

NOTE: Anything other than Memcached version 1.5.0 seems to cause intermittent issues that relies on calls to stats cachedump. If this is an issue, please report this issue to the upstream library for memcached.

API Documentation

Detailed API documentation can be found here.


Copyright © 2020 Verdigris Technologies, Inc. All rights reserved.

Verdigris Technologies Inc. assumes NO RESPONSIBILITY OR LIABILITY UNDER ANY CIRCUMSTANCES for usage of this software. See the LICENSE.md file for detailed legal information.