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

@neshca/cache-handler

v1.3.1

Published

Next.js self-hosting simplified.

Downloads

69,298

Readme

@neshca/cache-handler

Flexible API to replace the default Next.js cache, accommodating custom cache solutions for multi-instance self-hosted deployments

🎉 1.3.0 is out! It features the new keyExpirationStrategy option for the redis-strings Handler! It allows to use of a more performant API for the cache set operation but requires Redis server 6.2.0. Do not forget about the new neshCache application-side function for caching non-fetch data requests, e.g. axios or database queries.

Check out the changelog

npm package Dependencies License

Table of Contents

  1. Overview
  2. Getting Started with Your Own Custom Cache Solution
  3. Examples and Practical Implementations
  4. Requirements
  5. Documentation
  6. Developing and Contributing
  7. License

Overview

Welcome to @neshca/cache-handler, a specialized ISR/Data cache API crafted for Next.js applications. This library is designed to simplify the complex task of configuring shared cache strategies in distributed environments, such as those involving multiple and independent instances of the same application. It offers a flexible and user-friendly approach to integrating custom cache solutions and hand-crafted, pre-configured cache strategies for Redis.

Next.js Routers support

  • Full support for the Pages and the App Router.

The importance of shared cache in distributed environments

Next.js applications are often deployed in a self-hosted distributed environment, where multiple instances of the same application are running simultaneously. In such cases, the default Next.js cache is not shared between instances, causing the data to diverge between independent instances because load balancers route requests to a different instance every time. Another significant issue with the default cache setup is on-demand revalidation; it requires manual revalidation across all application replicas.

@neshca/cache-handler elegantly addresses these challenges by offering:

  • A straightforward API complemented by meticulously crafted Handlers.
  • Comprehensive customization options.
  • Simplified on-demand revalidation, akin to managing a single application instance.
  • TTL by default to keep cache storage clean and space-efficient.
  • One configuration for both Routes.
  • neshCache application-side function.

Kickstarting Your Custom Cache Solution

Begin enhancing your application's caching system with our Installation and the First Steps. This section provides all the necessary information on installation, basic configuration, and practical examples for quick and efficient integration.

Examples and Practical Implementations

Discover the versatility of @neshca/cache-handler in our Examples Section, where real-world scenarios are illustrated.

Learn how to build your own Handler by reading this guide.

Requirements

  • Next.js 13.5.1 and newer.
  • Node.js 18.17.0 and newer.

Documentation

Documentation ↗

Developing and contributing

Developing and contributing

License

MIT