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

cacheflowql

v1.1.3

Published

An advanced solution for all your graphQL queries

Readme

cacheflowQL

What is cacheflowQL?

CacheflowQL is an npm package with complex caching algorithms that provide developers deep insights into their GraphQL queries and metrics about their cached data, allowing for in-depth effective runtime and query analysis.

Who is cacheflowQL for?

CacheflowQL is for any developer looking for a lightweight way to cache data on GraphQL servers and receive in-depth metrics concerning the perfomance of their application in order to optimize run-time by utilizing server-side and Redis caching solutions.

Installing cacheflowQL

Download our NPM Package Here

  1. Install your npm dependencies: run npm install cacheflowql in your terminal

Require cacheflowQL in your server file

const { initCache, cache } = require('cacheflowql');

Set up initcache

Local:

  1. checkExpire: Determines the interval that cacheflow checks for expired data
  2. globalThreshold: A threshold value that users can set to prevent caching until input value is met

Redis:

  1. To connect to a redis store provide the host ip, port, and password
initCache({
  local: {
    checkExpire: 10,
    //How often to check if data should be deleted, in seconds

    globalThreshold: 10,
    //How often data needs to be requested to be cached, in seconds
  },
  redis: {
    host: '127.0.0.1',
    port: '6379',
    password: <'redis store password'>
  },
});

Choose which of your resolvers you want to cache

Wrap resolver within the callback function and return data from inside callback function


resolver(parent, args, ctx, info) {
      return cache(
        { location: 'local', maxAge: 60, smartCache: true },
        info,
        function callback() { return data };
      );
    },

Set up cacheConfig object

configObj = {
  location: 'local',
  //either 'local' or 'redis'
  maxAge: 60,
  //How long data will remain in local cache, in seconds
  smartCache: true,
  //boolean, determine if smart cache should be enabled
};

location

  • Set cache location; either local or on redis. Local and/or redis must be initiated using initCache function if either is being used.

maxAge

  • How long data will remain in local cache. After maxAge (in seconds) is passed, data is marked as expired and will be deleted.

smartCache

  • If you want to incorporate the smartCache capabilities of cacheflowQL you need to include a parameter in your cacheConfig object called smartCache and set it equal to true. Smartcache will prevent caching until thresholds are met. Thresholds are established by comparing metrics from specific resolvers to average metrics for all of the user's cached data.

Mutations

  • If you want the cache function to work with mutations you need to wrap mutation resolvers in cache function as well. In the cache config object include a parameter 'mutate' whose value is equal to the name of the query resolver you want to have update.
resolver(parent, args, context, info) {
      return cache(
        { location: 'redis', maxAge: 10, mutate: 'name of resolver to mutate' },
        info,
        function callback() {
          return data;
        }
      );
    },

Other inputs for cache function

The other two parameters in the cache function are info and a callback.

  1. The info parameter is the info parameter from the resolver itself
  2. The callback parameter will be whatever was in your resolver before using cacheflowQL

Simply return the call to cache with your three input parameters and you are set to cache!

return cache(cacheConfigObject, info, callback);

Terminal Commands

To run the terminal commands run node node_modules/cacheflowql/metricsTerminal.js. The terminal will then ask whether you want to view local or global metrics. If you want to see data about all data cached using the cache function input 'Global Metrics.' If you want to see data about a specific resolver simply enter the name of the resolver.

Next Steps

We’re off to a great start but are always looking to add new features! Send your comments, questions, and suggestions to [email protected] or simply fork our repo, checkout to a feature branch and get to work improving our product. Happy Caching!

cacheflowQL is a beta product developed under OSLabs