# next-lru-cache

> Little LRU cache for Next.js

Latest version **1.0.1** (published 2019-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install next-lru-cache
pnpm add next-lru-cache
yarn add next-lru-cache
bun add next-lru-cache
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-08-26 |
| First published | 2019-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tiaanduplessis |

## Links

- npm: https://www.npmjs.com/package/next-lru-cache
- npm.io page: https://npm.io/package/next-lru-cache

## Dependencies (1)

- [lru-cache](https://npm.io/package/lru-cache.md) ^5.1.1

## Recent versions

- 1.0.1 (latest) — 2019-08-26
- 1.0.0 — 2019-08-26

## README

# next-lru-cache
[![package version](https://img.shields.io/npm/v/next-lru-cache.svg?style=flat-square)](https://npmjs.org/package/next-lru-cache)
[![package downloads](https://img.shields.io/npm/dm/next-lru-cache.svg?style=flat-square)](https://npmjs.org/package/next-lru-cache)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![package license](https://img.shields.io/npm/l/next-lru-cache.svg?style=flat-square)](https://npmjs.org/package/next-lru-cache)
[![make a pull request](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

> Little LRU cache for Next.js

## Table of Contents

- [About](#about)
- [Usage](#usage)
- [Install](#install)
- [Contribute](#contribute)
- [License](#License)

## About

Based on [this article](https://medium.com/@igordata/how-to-cache-all-pages-in-next-js-at-server-side-1850aace87dc) by Igor Data.

## Usage

```js
const express = require('express')
const next = require('next')

const nextLRUCache = require('next-lru-cache')

const app = next({ dev: process.env.NODE_ENV !== 'production' })

app
  .prepare()
  .then(() => {
    const server = express()

    nextLRUCache(server, app)

    server.listen(3000, err => {
      if (err) {
        throw err
      }
      console.log('> Running on port 3000')
    })
  })
  .catch(error => {
    console.error(error.stack)
    process.exit(1)
  })

```


## Install

This project uses [node](https://nodejs.org) and [npm](https://www.npmjs.com).

It requires [express](https://expressjs.com/) and [next](https://nextjs.org/) as peer dependencies.

```sh
$ npm install next-lru-cache
$ # OR
$ yarn add next-lru-cache
```

## Contribute

1. Fork it and create your feature branch: `git checkout -b my-new-feature`
2. Commit your changes: `git commit -am "Add some feature"`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request

## License

MIT

---
_Source: https://npm.io/package/next-lru-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
