How to use BentoCache ? #4487
-
I saw BentoCache announced in https://adonisjs.com/blog/adonisjs-v6-announcement Wanted to try it Saw https://www.npmjs.com/package/@adonisjs/cache It looks great but the Generated config is default: 'redis',
} And I don't want Redis, I want BentoCache I can t find any documentation How to use BentoCache ? Is there a guide somewhere ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Please see : https://adonisjs.com/blog/future-plans-for-adonisjs-6#adonisjscache TLDR : adonisjs/cache is still under development and not yet released, but you can use bentocache quite easily by installing |
Beta Was this translation helpful? Give feedback.
-
Ok I think I found some things to do here https://github.com/adonisjs-community/adonis-packages/blob/main/config/cache.ts const cacheConfig = defineConfig({
default: env.get('CACHE_STORE') || 'cache',
// From https://github.com/adonisjs-community/adonis-packages/blob/main/config/cache.ts
/**
* When we are 90% close to the cache expiration, we will
* start refreshing the claimed cache key in the background
*/
earlyExpiration: 0.9,
/**
* Cache each response for 1 day. This is okay since npm/GitHub
* stats are not something that is absolutely required to be
* real-time
*/
ttl: '1d',
/**
* Grace period is 14 days. Meaning, we gonna keep serving the
* old value for 2 weeks, if we are unable to fetch the new
* value from the API (Rate limit, GitHub/npm down etc...?)
*/
gracePeriod: {
enabled: true,
duration: '2d',
fallbackDuration: '5m',
},
stores: {
cache: store().useL1Layer(drivers.memory({ maxSize: 50 * 1024 * 1024 })),
ogImage: store({ ttl: null }),
test: store().useL1Layer(drivers.memory({})),
},
})
export default cacheConfig |
Beta Was this translation helpful? Give feedback.
Please see : https://adonisjs.com/blog/future-plans-for-adonisjs-6#adonisjscache
TLDR : adonisjs/cache is still under development and not yet released, but you can use bentocache quite easily by installing
bentocache
like any other package.