How to use koa-cash - 1 common examples

To help you get started, we’ve selected a few koa-cash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JounQin / react-hackernews / server / index.js View on Github external
)

  const files = {}

  middlewares.splice(
    1,
    0,
    compress(),
    serve(
      resolve('dist/static'),
      {
        maxAge: MAX_AGE,
      },
      files,
    ),
    cash({
      get: key => cache.get(key),
      set: (key, value) => cache.set(key, value),
    }),
  )

  files['/service-worker.js'].maxAge = 0
}

app.use(compose(middlewares))

app.listen(serverPort, serverHost, () => {
  debug(`Server start listening at %s:%s`, serverHost, serverPort)
})

koa-cash

HTTP response caching for Koa. HTTP response caching for Koa. Supports Redis, in-memory store, and more!

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular koa-cash functions