新增缓存支持

This commit is contained in:
cool 2024-03-16 16:09:19 +08:00
parent 3ee0695785
commit af0ee28433
2 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@cool-midway/plugin-cli",
"version": "7.1.3",
"version": "7.1.4",
"description": "cool-admin midway plugin",
"main": "dist/index.js",
"scripts": {
@ -22,7 +22,8 @@
"readme": "README.md",
"license": "MIT",
"dependencies": {
"@midwayjs/core": "^3.14.0",
"@midwayjs/cache-manager": "^3.15.2",
"@midwayjs/core": "^3.15.0",
"archiver": "^6.0.1",
"esbuild": "^0.19.11",
"esbuild-plugin-copy": "^2.1.1"
@ -30,4 +31,4 @@
"devDependencies": {
"typescript": "^5.3.3"
}
}
}

View File

@ -1,3 +1,4 @@
import { MidwayCache } from "@midwayjs/cache-manager";
import { IMidwayContext, IMidwayApplication } from "@midwayjs/core";
// 文件上传
@ -46,6 +47,8 @@ export abstract class BasePlugin {
ctx: IMidwayContext;
/** 应用实例用到此项无法本地调试需安装到cool-admin中才能调试 */
app: IMidwayApplication;
/** 缓存 */
cache: MidwayCache;
setCtx(ctx: IMidwayContext) {
this.ctx = ctx;
@ -66,10 +69,14 @@ export abstract class BasePlugin {
async init(
pluginInfo: PluginInfo,
ctx?: IMidwayContext,
app?: IMidwayApplication
app?: IMidwayApplication,
other?: any
) {
this.pluginInfo = pluginInfo;
this.ctx = ctx;
this.app = app;
if (other) {
this.cache = other.cache;
}
}
}