@dalongrong/cubejs-schemaversion-cache

1.0.9 • Public • Published

cubejs-schemaversion-cache

using cache-manager for cache multi tennant schemaversion

Usage

yarn add @dalongrong/cubejs-schemaversion-cache

cube.js

// Cube.js configuration options: https://cube.dev/docs/config
const {pause,schemaVersion,scheduledRefreshContexts} = require("@dalongrong/cubejs-schemaversion-cache")

// one demo func 
async function fetchVersion(securityContext){
  await pause(3000)
  console.log("call version")
  return `"dalong"---${parseInt(Math.random()*100)}`
}

// one demo func 
async function fetchscheduleContexts(){
  await pause(3000)
  return  [
   {
      authInfo: {
        myappid: 'demoappid',
        bucket: 'demo',
      },
    },
    {
      authInfo: {
        myappid: 'demoappid2',
        bucket: 'demo2',
      }
    }
  ]
}
module.exports = {
  schemaVersion:  ({ securityContext }) =>{
    return schemaVersion(securityContext,fetchVersion)
  },
  scheduledRefreshContexts:async ()=>{
    return scheduledRefreshContexts(fetchscheduleContexts)
  }
  contextToAppId: ({ securityContext }) => {
   return  `CUBEJS_APP_${securityContext.user_id}`
  }
};

Readme

Keywords

none

Package Sidebar

Install

npm i @dalongrong/cubejs-schemaversion-cache

Weekly Downloads

1

Version

1.0.9

License

Apache-2.0

Unpacked Size

4.23 kB

Total Files

5

Last publish

Collaborators

  • dalongrong