1.1.5 • Published 2 years ago

@luispittagros/nuxt-ssr-redis-cache v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Setup

npm install @luispittagros/nuxt-ssr-redis-cache --save

Usage

In nuxt.config.js:

modules: [
   [
      '@luispittagros/nuxt-ssr-redis-cache',
      {
        enabled: true,
        client: {
          socket: {
            host:  '127.0.0.1',
            port: 6379,
          },
          password: null,
        },
        paths: [/^\/$/, '/articles/'], // If empty or "/" is set all pages will be cached
        ttl: 60 * 60, // 1 hour
        cacheCleanEndpoint: {
          enabled: false, 
          path: '/ssr-redis-cache',
          cors: '*',
        },
      }
    ]
],

or

  modules: ['@luispittagros/nuxt-ssr-redis-cache'],
  ssrRedisCache: {
    enabled: true,
    client: {
      socket: {
        host: '127.0.0.1',
        port: 6379,
      },
      password: null,
    },
    paths: [/^\/$/, '/articles/'], // If empty or "/" is set all pages will be cached
    ttl: 60 * 60, // 1 hour
    cacheCleanEndpoint: {
      enabled: true, 
      path: '/ssr-redis-cache',
      cors: '*',
    }
  },
Redis Client Configuration

For the client configuration check node-redis for reference here.

Cache Clean Endpoint

Creates an endpoint that cleans cached paths, it's useful when you have content that might change often.

To call the endpoint you must make a POST request to your Nuxt appplication using the path you defined (defaults to '/ssr-redis-cache') with the following JSON request body:

{
   "paths" : [ "/", "/example/" ]
}

Use "*" as path to delete all cached pages.

For the CORS options check the express cors middleware options here.

Cached Pages

Cacheable/Cached pages have the HTTP response header "X-Cache" which has the value "HIT" or "MISS" accordingly.

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago