Sample catbox cache initialization:
const Catbox = require('@hapi/catbox');
const { Engine: CatboxRedis } = require('@hapi/catbox-redis');
const cache = new Catbox.Client(CatboxRedis, {
partition : 'my_cached_data',
host: 'redis-cluster.domain.com',
port: 6379,
db: 0,
tls: {},
});
When used in a hapi server (hapi version 18 or newer):
const Hapi = require('hapi')
const { Engine: CatboxRedis } = require('@hapi/catbox-redis');
const server = new Hapi.Server({
cache : [
{
name: 'my_cache',
provider: {
constructor: CatboxRedis,
options: {
partition : 'my_cached_data',
host: 'redis-cluster.domain.com',
port: 6379,
db: 0,
tls: {},
}
}
}
]
});