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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@via-profit/dataloader

v1.0.6

Published

Via Profit Redis-Dataloader

Readme

Via Profit / dataloader

npm (scoped) NPM npm bundle size (scoped)

Table of Contents

Overview

This module is a fork of the package GraphQL DataLoader with some changes to allow the use of Redis cache with the ability to specify the expiration time of each of its elements.

Installation

We used IO Redis package as Redis client. You must install this dependency to.

# yarn
yarn add @via-profit/dataloader ioredis

# npm
npm i @via-profit/dataloader ioredis

Getting Started

Setup Reids using ioredis and pass it to constructor.

import DataLoader from '@via-profit/dataloader';
import Redis from 'ioredis';

const redis = new Redis();
const loader = new DataLoader({
  // ioredis instance
  redis,

  // Each dataloader creates its own cache in Redis.
  // Therefore, the `cacheName` must be a unique key in Redis.
  // It is better to use a meaningful name for the `cacheName`
  cacheName: 'books',

  // Default value of expiration time of each value placed in the cache
  // It will be used in cases of calling 'load` without the expires argument.
  // Format: digit + entity
  defaultExpiration: '12 hours',
});

// Now you can start the load your data
loader.load('fde7fcf7-984d-44b8-8504-d6347e105f56');
loader.load('34bcab6b-7207-4883-a442-92d21e53d31d');
loader.loadMany(['e3fd7057-858b-43f9-b276-0c631e0de1af', 'ba995e24-0d05-4de4-a12c-756c009f3620']);

API

Use TypeScript for more data abot API and arguments

| Name | Arguments | Return type | Description | | :---------- |:- | :-----------------: | :----------------------------------------- | | load | key: string, [expires: string \| number] | Promise<T\|null> | Loads one entity by key | | reload | key: string, [expires: string \| number] | Promise<T\|null> | Loads one entity by key and ignore cache, but put loaded data into the cache | | reloadMany | keys: string[], [expires: string \| number] | Promise<T[]> | Loads one or more entities by keys and ignore cache, but put loaded data into the cache | | loadMany | keys: string[], [expires: string \| number] | Promise<T[]> | Loads one ore more entities | | clear | key: string | Promise<this> | Clear one entity by key | | clearMany | keys: string[] | Promise<this> | Clear one ore more entities | | clearAll | - | Promise<this> | Clear all entities | | prime | value: T, [expires: string \| number] | Promise<this> | Put data to dataloader cache | | primeMany | values: T[], [expires: string \| number] | Promise<this> | Put more then one data to dataloader cache |