GithubHelp home page GithubHelp logo

baroshem / cache Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 1.0 515 KB

🔋 Browser and Server Cache module for Nuxt 3

Home Page: https://cache-nm.netlify.app

License: MIT License

JavaScript 3.09% TypeScript 91.18% Vue 5.73%
cache performance nuxt

cache's Introduction

@nuxt-modules/cache

[DEPRECATED] @nuxt-modules/cache

As of Nuxt 3.rc-12 you can use routeRoules so this module is now deprecated. Please use official Nuxt approach

npm version npm downloads Github Actions CI Codecov License

Browser and Server Cache module for Nuxt 3

Features

  • Nuxt 3 ready
  • Easy Browser Cache Control middleware
  • Powerful Server Cache with Redis, memcached, etc [Coming soon]
  • TypeScript support

📖  Read the documentation

Setup

yarn add @nuxt-modules/cache # yarn
npm i @nuxt-modules/cache # npm

Basic usage

Firstly, you need to add @nuxt-modules/cache to your Nuxt config.

// nuxt.config.js

{
  buildModules: [
    [
      '@nuxt-modules/cache',
      {
        browser: {
          pages: [
            ['/', { 'max-age': 3600, 'stale-when-revalidate': 10 }],
            ['/product', { 'max-age': 3600, 'stale-when-revalidate': 10 }],
            ['/category', { 'max-age': 3600, 'stale-when-revalidate': 10 }]
          ]
        }
      }
    ]
  ]
}

And that's it! The module is registered and now your pages will have cache-control headers applied.

@nuxt-modules/cache

For more configuration options, please visit the docs

Configuration of server cache will be added in the next versions.

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using yarn dev or npm run dev

License

MIT License

cache's People

Contributors

baroshem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

abbijamal

cache's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.