UNPKG

k-fastify-gateway

Version:
15 lines (11 loc) 364 B
const matcher = require('matcher') const getKeys = (cache, pattern) => new Promise((resolve) => { if (pattern.indexOf('*') > -1) { const args = [pattern, (_, res) => resolve(matcher(res, [pattern]))] if (cache.store.name !== 'redis') { args.shift() } cache.keys.apply(cache, args) } else resolve([pattern]) }) module.exports = getKeys