catbox-sequelize

0.0.2 • Public • Published

catbox-sequelize

Sequelize adapter for catbox

Options

The connection can be specified with one (and only one) of:

  • sequelize - a custom Sequelize client instance where sequelize must:

    • be manually started and stopped,
    • manually synced
    • not already synced
  • url - a Sequelize server URL.

catbox options:

  • partition - the table used for the cache. Defaults to catbox.

Usage

Sample catbox cache initialization:

const Catbox = require('@hapi/catbox')
const CatboxSequelize = require('catbox-sequelize')


const cache = new Catbox.Client(CatboxRedis, {
  partition : 'my_catbox_cache'
  url: 'postgres://user:pass@example.com:5432/dbname'
})

When used in a hapi server (hapi version 18 or newer):

const Hapi = require('hapi')
const CatboxSequelize = require('catbox-sequelize')

const server = new Hapi.Server({
  cache: [
    {
      name: 'my_cache',
      provider: {
        constructor: CatboxSequelize,
        url: 'postgres://user:pass@example.com:5432/dbname'
      }
    }
  ]
})

Tests

The test suite expects a postgresql server on the standart port with a database named catbox owned by a user catbox with the password catbox

To set it up locally, run npm run db

Readme

Keywords

Package Sidebar

Install

npm i catbox-sequelize

Weekly Downloads

0

Version

0.0.2

License

BSD-3-Clause

Unpacked Size

24 kB

Total Files

6

Last publish

Collaborators

  • mkg20001