import { Model } from 'sequelize-typescript'
-import * as Bluebird from 'bluebird'
import { logger } from '@server/helpers/logger'
type ModelCacheType =
doCache<T extends Model> (options: {
cacheType: ModelCacheType
key: string
- fun: () => Bluebird<T>
+ fun: () => Promise<T>
whitelist?: () => boolean
deleteKey?: DeleteKey
}) {
if (cache.has(key)) {
logger.debug('Model cache hit for %s -> %s.', cacheType, key)
- return Bluebird.resolve<T>(cache.get(key))
+ return Promise.resolve<T>(cache.get(key))
}
return fun().then(m => {