Skip to content

Releases: Julien-R44/bentocache

bentocache@1.0.0-beta.12

09 Oct 21:49
Compare
Choose a tag to compare

Commits

  • refactor: Only one bus instance per named cache. All subsequent namespaces under it use the same bus. (3813247)
  • fixed return type for CacheStack namespace function (c772f83)
  • optimize: added namespace cache to CacheStack to avoid unnecessary creation of caches and buses (eaef9d8)
  • fix: clear message goes to all bus instances since channel name is the same (1699fe6)

What's Changed

  • fix: clear message goes to all bus instances + refactor: to optimize bus sync by @gkachru in #39

Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.11...bentocache@1.0.0-beta.12

bentocache@1.0.0-beta.11

04 Oct 21:47
Compare
Choose a tag to compare

What's Changed

  • fix: BinaryEncoding did not encode/decode the Clear message type by @gkachru in #38

Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.10...bentocache@1.0.0-beta.11

Bug fixes

03 Oct 19:33
Compare
Choose a tag to compare

Commits

  • chore: add server playground (7613081)
  • docs: add note about DynamoDB TTL configuration (d0024dd)
  • chore: update lock file (96c1924)
  • chore: add dynamodb in playground (c5e646c)
  • Fix: Issue of synchronizing namespaced local memory caches (#37) (f077d30)
  • fix: remove ttl usage from getOrSetForever (32943e2)
  • fix: use undefined instead of Infinity for memory driver (7267974)
  • fix: use specific poppinss/utils import path for exceptions (e00ac08)
  • chore: update dependencies (f22c953)
  • chore(docs): prometheus dashboard json url updated (#23) (9d66e2f)

What's Changed

  • chore(docs): prometheus dashboard json url updated by @joravkumar in #23
  • Fix: Issue of synchronizing namespaced local memory caches by @gkachru in #37

New Contributors

Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.9...bentocache@1.0.0-beta.10

Orchid ORM support

17 May 18:27
Compare
Choose a tag to compare

Features

Orchid ORM support

We now have first-class support for Orchid ORM thanks to a PR from @bingtsingw!

See https://bentocache.dev/docs/cache-drivers#orchid-orm

Commits

  • fix: bus utf8 characters handling (7690bc2)
  • chore: update dependencies (35263ec)
  • chore: remove obsolete version in compose file (105841f)
  • feat: add Orchid ORM driver (#17) (695cd71)
  • Fixes missing comma in Knex code example (#18) (1822312)
  • chore: add banner (3bb8127)
  • chore: add sponsors (517dd97)

What's Changed

New Contributors

Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.8...bentocache@1.0.0-beta.9

Lot of goodies

11 Apr 08:50
Compare
Choose a tag to compare

Breaking Changes

We've introduced an adapter system for the database store, which allows us to decouple Knex from Bentocache. This change brings a few breaking changes:

  • All specific drivers like mysqlDriver, sqliteDriver, etc., have been removed. You should now use knexDriver instead.
  • The knex driver won't automatically create the knex instance anymore. You'll need to create the instance yourself and pass it to the adapter.

For more information, check out the documentation here.

Features

Database Adapter

We've added an adapter system to Bentocache, allowing us to decouple from Knex. This means you can now use a different ORM/Query builder such as Prisma, Kysely, Drizzle... You can use the same ORM that's already part of your application.

Kysely Adapter

With the new adapter system, we're introducing a built-in adapter for Kysely for the database store. You can find instructions on how to use Kysely with Bentocache here.

Adaptive Caching

Sometimes, we can't predetermine the TTL to use. For example, when fetching a token from an API that returns the token and its lifespan. It would be great to set the TTL to match the token's lifespan. This wasn't possible with the getOrSet method before. That's why we've introduced adaptive caching:

const authToken = await bento.getOrSet('token', async (options) => {
  const token = await fetchAccessToken();
  options.setTtl(token.expiresIn);
  return token;
});

In short, you can now dynamically set the TTL based on certain parameters from your factory function. For more information, check the documentation.

File Driver Automatic Eviction

Until now, using the file driver for our cache meant that files kept accumulating, never deleting even after the cached values expired. Because, well, File system doesn't have a TTL system.

To address this, we've added an automatic eviction system. The concept is simple: start a worker thread that regularly cleans up files with expired entries.

For more details, see here.

POJOs Methods

Most of the methods now accept arguments in two different ways : either as a single argument or as an object.

If you need to pass some specific options, the object way is probably the best choice since it is more "vertical" and may be easier to read. On the other hand, the single argument may be more concise when you don't need to pass specific options.

Example:

// multiple arguments
await bento.getOrSet('products', () => fetchProducts(), {
  ttl: '5m',
  gracePeriod: { enabled: true, duration: '1m' },
})

// is equivalent to
await bento.getOrSet({
  key: 'products',
  ttl: '5m',
  factory: () => fetchProducts(),
  gracePeriod: { enabled: true, duration: '1m' },
})

Boring Bus

Bentocache Bus has been exported into a generic package here. As a result, Bentocache was refactored to use this new package.

Along the way, we improved the bus, fixed some bugs, and added a retry interval concept for the retry queue. Thanks to @RomainLanz for the work on this package!

Commits

  • fix: connection options wrongly passed to redis transport (e92d835)
  • chore: add hono example (3785f7b)
  • feat: pojo methods syntax (#15) (01d1d4b)
  • refactor: move to @boringnode/bus (#14) (ff32759)
  • doc: fix invalid url (bb4ea66)
  • refactor: remove deprecated dependency (393f316)
  • feat: add adaptive caching (1ec8c29)
  • refactor: move test_helpers to tests folder (0068d36)
  • feat: cleaner worker thread for File Driver (#13) (3a839e7)
  • refactor: add Driver suffix to all drivers (b718b95)
  • ci: update ci deps (58d4879)
  • feat!: add adapter system for database store (#12) (08fff55)
  • chore: remove upstash tests (9ed2738)
  • chore: ts checks (146ecd4)
  • chore: update dependencies (ee94407)

bentocache@1.0.0-beta.7

01 Feb 13:37
Compare
Choose a tag to compare

Changes

Commits

  • chore: update lockfile (22478fb)
  • refactor: chainable cache factory method (96a61a6)
  • refactor: make CacheFactory setup more explicit (dba0a82)
  • chore(docs): handle redirect (da7b486)
  • update @poppinss/utils (92e050f)
  • chore(docs): update to adonis 6 (d9849a9)
  • refactor: test suite api (f0f3764)
  • chore: add missing readme (edc023c)
  • chore: fix jsdoc position (adb49ae)

New Contributors

Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.6...bentocache@1.0.0-beta.7

bentocache@1.0.0-beta.6

27 Dec 22:26
Compare
Choose a tag to compare

Fixes

  • Background factories that threw an error could kill the application if no graced value was found.
  • Background factories that threw an error wasnt releasing the locks.

Internal

  • Migration to a monorepo. We now have the docs website, @bentocache/plugin-prometheus, bentocache and a playground under this same repo

@bentocache/plugin-prometheus@0.1.0

27 Dec 22:21
Compare
Choose a tag to compare

Prometheus plugin

Initial release for the prometheus plugin of Bentocache.
See documentation here : https://bentocache.dev/docs/plugin-prometheus#keygroups

Release 1.0.0-beta.5

22 Nov 20:32
Compare
Choose a tag to compare
  • test: fix failing test due to await removal (e31115f)
  • chore: update dependencies (92aa8e7)
  • refactor: remove useless await (9a4ec5a)
  • style: apply new lint/format rules (6853e32)
  • feat: add pruneInterval options on sql drivers (8a7e3d5)
  • fix: remote graced value not returned when soft timeout is reached (6df18f2)
  • fix: add missing options on core methods (c3373d7)
  • refactor: remove hack regarding getRemainingTtl on L1CacheDriver (0c06621)
  • fix: make clear options optional (935993f)
  • fix: refactor remote_cache facade + add suppressL2Errors on has/delete methods (076e68e)
  • chore: add benchmark for single tier set operation (b7cb947)
  • refactor: make memoryDriver options optional (9148aef)

Full Changelog: v1.0.0-beta.4...v1.0.0-beta.5

Plugin System + SQL Drivers

07 Nov 13:56
Compare
Choose a tag to compare

Breaking Changes

There are two small breaking changes in this version.

  • the suppressRemoteCacheErrors option becomes suppressL2Errors to remain consistent with the rest of the api (remote caches are now referred to as "l2 caches").
  • Database drivers are now exported from bentocache/drivers/sql rather than bencache/drivers/mysql, bencache/drivers/postgres etc...

Features

Plugin System

Added a basic plugin system for the moment. But enough to do some cool stuff. The idea behind this is to quickly publish a first plugin for bentocache, which will allow metrics to be recorded via Prometheus. In order to have a nice Grafana dashboard to monitor your cache. In short, it works like this:

import type { BentoCachePlugin } from 'bentocache/types'

export function promMetricsPlugin(): BentoCachePlugin {
  return {
     register(bentocache) {
        bentocache.on('cache:miss', doSomething)
        bentocache.on('cache:hit', doSomething)
     }
   } 
}

const bento = new BentoCache({
  // ...
  plugins: [promMetricsPlugin()]
})

Commits

  • chore: update package.json scripts to use pnpm instead of npm (3b1f2fb)
  • ci: upgrade actions/checkout (aa4eee8)
  • ci: remove redis-insight (1ac8fbb)
  • fix: add missing clear() bus publishing (900deb1)
  • chore: remove unnecessary await (94d3b3e)
  • refactor!: export all sql drivers from bentocache/drivers/sql path (267ff5b)
  • feat: add defaultStoreName getter on bentocache (0dfcb0c)
  • chore: remove peerDep to @vercel/kv (baababe)
  • refactor!: rename suppressRemoteCacheErrors to suppressL2Errors (5549fdf)
  • feat: re-export registerCacheDriverTestSuite (86120af)
  • feat: add basic plugin system (73bf242)

Full Changelog: v1.0.0-beta.3...v1.0.0-beta.4