Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-multi-cache

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-multi-cache

SSR route, component and data cache for Nuxt.js

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.5K
increased by26.46%
Maintainers
1
Weekly downloads
 
Created
Source

nuxt-multi-cache

SSR page, component and data cache for Nuxt. Supports purging cache entries by key or by cache tags.

Installation - Documentation - NPM

Concepts

  • Cache: Page, component and data with support for cache tags
  • Purge: Using cache tags or by key
  • Pick: Enable only what you need
  • Manage: REST API for purging and getting stats about the caches

Example

Cache a page with cache tags

<template>
  <div>
    <h1>Welcome!</h1>
  </div>
</template>

<script>
export default {
  asyncData({ app }) {
    return app.$api.get('article', { id: 10 }).then(article => {
      app.$cache.page.setCacheable()
      app.$cache.page.addTags(['article:10'])
      return { article }
    })
  },

  data() {
    return {
      article: {}
    }
  }
}
</script>

Purge a cached page

curl -X POST -i \
  -H "Authorization: Basic YWRtaW46aHVudGVyMgo=" \
  -H "Content-Type: application/json" \
  --data '["article:10"]' \
  http://localhost:3000/__nuxt_multi_cache/purge/tags

Warning

Caching is hard. You should be aware of the risks and potentially huge security issues that may arise when caching an entire page.

Always make sure to never cache anything with content restricted to authenticated users. Else you may leak sensitive information to anonymous users.

Keywords

FAQs

Package last updated on 24 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc