0.0.2 • Published 5 years ago

catbox-sequelize v0.0.2

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
5 years ago

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

0.0.2

5 years ago

0.0.1

5 years ago