diff --git a/libs/services/data-record.js b/libs/services/data-record.js index ea1f5ff..5468214 100644 --- a/libs/services/data-record.js +++ b/libs/services/data-record.js @@ -1,12 +1,11 @@ const fp = require('fastify-plugin'); -const BUFFER_CACHE_KEY = 'statistics:data-record:buffer'; - module.exports = fp(async (fastify, options) => { const { models } = fastify[options.name]; const { Op } = fastify.sequelize.Sequelize; const sequelize = fastify.sequelize.instance; const log = fastify.log; + const BUFFER_CACHE_KEY = `${options.name || 'statistics'}:data-record:buffer`; const cache = options.cache || null; const flushInterval = options.collectFlushInterval || 5000; diff --git a/package.json b/package.json index 16cac0b..c054f6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kne/fastify-statistics", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "description": "基于 Fastify 的数据采集与多周期聚合统计插件,支持缓冲写入、时区查询和自动 Cron 聚合", "main": "index.js", "scripts": {