Releases: Julien-R44/bentocache
bentocache@1.0.0-beta.12
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
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
What's Changed
Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.10...bentocache@1.0.0-beta.11
Bug fixes
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 ofInfinity
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
- @joravkumar made their first contribution in #23
- @gkachru made their first contribution in #37
Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.9...bentocache@1.0.0-beta.10
Orchid ORM support
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
- Fixes missing comma in Knex code example by @DilwoarH in #18
- feat: add orchid driver by @bingtsingw in #17
New Contributors
- @DilwoarH made their first contribution in #18
- @bingtsingw made their first contribution in #17
Full Changelog: https://github.com/Julien-R44/bentocache/compare/bentocache@1.0.0-beta.8...bentocache@1.0.0-beta.9
Lot of goodies
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 useknexDriver
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
Changes
- Breaking change : updated the test suite API. See new usage here https://bentocache.dev/docs/custom-cache-driver#tests
- Fix when used in another context than Node( Vite for example ), an import to @poppinss/utils was throwing an error
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
- @TiBianMod made their first contribution in #6
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
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
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
- 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
Breaking Changes
There are two small breaking changes in this version.
- the
suppressRemoteCacheErrors
option becomessuppressL2Errors
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 thanbencache/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