Skip to content

Releases: next-boost/next-boost

Metrics support and cache status header

22 Dec 01:59
Compare
Choose a tag to compare

In 0.15.x, two new features are added

  • Prometheus metrics
  • Cache status in HTTP header

Prometheus metrics

You can enable metrics in the config

// in .next-boost.js
{
 ...
  metrics: true,
}

And by requesting __nextboost_metrics, you'll get Prometheus style metrics

$ curl http://localhost:3000/__nextboost_metrics
next_boost_requests_total{status='stale'} 1
next_boost_requests_total{status='bypass'} 32
next_boost_requests_total{status='hit'} 2

Cache status in HTTP header

Also, a x-next-boost-status header is now returned in all requests

$ curl -I  http://localhost:3000/
HTTP/1.1 200 OK
x-next-boost-status: hit
x-powered-by: Next.js
etag: "f5274-diDR3qXA2Yvq7BYsnHn3HjQ3Qq8"
content-type: text/html; charset=utf-8
content-length: 262875
cache-control: private, no-cache, no-store, max-age=0, must-revalidate
date: Wed, 22 Dec 2021 01:57:00 GMT
connection: close
content-encoding: gzip

Binary encoder for better performance

12 Dec 17:04
Compare
Choose a tag to compare

Now headers and body are encoded in their own binary format before storing in the cache.
This makes it faster and safer to read/write data from the cache.

Also, exception handling has been added when data from the cache is corrupted.

Use sync lock from cache

12 Dec 03:02
Compare
Choose a tag to compare

After we've added the official support of redis-cache adapter, it's obvious that using a process-level SYNC_LOCK will not be able to sync between different instances in a cluster of next-boost.

In this release, the SYNC_LOCK is moved to the cache and thus be able to be shared between instances.

Fix unhandled exception

12 Dec 02:59
Compare
Choose a tag to compare

Add handling when we have corrupted data in the cache.

A new home & graceful shutdown

09 Dec 03:40
Compare
Choose a tag to compare

In this release, we've moved next-boost to its own organization with other related libs.

You can install the new package with npm install @next-boost/next-boost

And the following features are added:

  • Graceful shutdown by SIGTERM (edfb5f3)
  • Peer dependencies for Next.js upgraded to 12.x

With the following bugs fixed:

Adding function based rules resolver

21 Oct 05:20
Compare
Choose a tag to compare

A much flexible way to control how the cache works for different requests.

Functions should return valid TTL for the request. If the function returns 0 or falsy value
the request will not be cached.

// in .next-boost.js
{
  ...
  rules: (req) => {
      if (req.url.startsWith('/blog')) {
          return 300
      }
  }
}

Thank you @capJavert for bringing us the PR #52

Async Cache Interface

04 Aug 06:45
Compare
Choose a tag to compare

All the underlying cache interfaces are now async.

And this will make it possible to add cache adapters like Redis and more.

export type CacheAdapter = {
  set(key: string, value: Buffer, ttl?: number): Promise<void>
  get(key: string, defaultValue?: Buffer): Promise<Buffer | undefined>
  has(key: string): Promise<CacheStatus>
  del(key: string): Promise<void>
}

Force production

25 Jun 02:26
Compare
Choose a tag to compare

As next-boost is a drop-in replacement for next start, we'll force the NODE_ENV to be production in this release, which is also next start's default behavior.

Thanks @atdrago for reporting this in #42

Support Next.js v11

22 Jun 08:15
Compare
Choose a tag to compare
  • Support Next.js v10 & v11
  • Update packages

Fix cacheKey's execution order

18 Mar 04:59
Compare
Choose a tag to compare

Use filtered URL to generate the cacheKey.