1.0.9 • Published 3 years ago

@dalongrong/cubejs-schemaversion-cache v1.0.9

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

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}`
  }
};
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago