1.0.1 • Published 5 years ago

next-lru-cache v1.0.1

Weekly downloads
19
License
MIT
Repository
-
Last release
5 years ago

next-lru-cache

package version package downloads standard-readme compliant package license make a pull request

Little LRU cache for Next.js

Table of Contents

About

Based on this article by Igor Data.

Usage

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 and npm.

It requires express and next as peer dependencies.

$ 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