@jayfong/x-server 2.2.6 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,7 +39,7 @@ function makeBaseModel<TModelName extends ModelName>(name: TModelName) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// @index('../.prisma/client/index.d.ts', /(?<=const ModelName:).+?(?=\})/s, /(\S+?):/g, (m, _) => `export const ${
|
|
42
|
+
// @index('../.prisma/client/index.d.ts', /(?<=const ModelName:).+?(?=\})/s, /(\S+?):/g, (m, _) => `export const ${m[1]}BaseModel = makeBaseModel('${_.camel(m[1])}')`)
|
|
43
43
|
// @endindex
|
|
44
44
|
|
|
45
45
|
export * from '@prisma/client'
|
|
@@ -208,6 +208,10 @@ class CacheService {
|
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
async remove(...keys) {
|
|
211
|
+
if (!keys.length) {
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
211
215
|
return _x.x.redis.del(...keys.map(key => this.toRedisKey(key)));
|
|
212
216
|
}
|
|
213
217
|
/**
|
|
@@ -230,6 +234,10 @@ class CacheService {
|
|
|
230
234
|
|
|
231
235
|
|
|
232
236
|
async clear(...prefixes) {
|
|
237
|
+
if (!prefixes.length) {
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
233
241
|
const keys = (await Promise.all(prefixes.map(prefix => _x.x.redis.keys(`${this.toRedisKey(prefix)}*`)))).flat();
|
|
234
242
|
|
|
235
243
|
if (keys.length) {
|
|
@@ -39,7 +39,7 @@ function makeBaseModel<TModelName extends ModelName>(name: TModelName) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// @index('../.prisma/client/index.d.ts', /(?<=const ModelName:).+?(?=\})/s, /(\S+?):/g, (m, _) => `export const ${
|
|
42
|
+
// @index('../.prisma/client/index.d.ts', /(?<=const ModelName:).+?(?=\})/s, /(\S+?):/g, (m, _) => `export const ${m[1]}BaseModel = makeBaseModel('${_.camel(m[1])}')`)
|
|
43
43
|
// @endindex
|
|
44
44
|
|
|
45
45
|
export * from '@prisma/client'
|
package/lib/services/cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncOrSync, IsEmptyArray
|
|
1
|
+
import { AsyncOrSync, IsEmptyArray } from 'vtils/types';
|
|
2
2
|
import { BaseService } from './base';
|
|
3
3
|
import { MsValue } from 'vtils/date';
|
|
4
4
|
export interface CacheServiceOptions {
|
|
@@ -103,7 +103,7 @@ export declare class CacheService<TData extends Data = Data, TKey extends Key<TD
|
|
|
103
103
|
/**
|
|
104
104
|
* 清空指定前缀的缓存。
|
|
105
105
|
*/
|
|
106
|
-
clear<K extends TKey>(...prefixes:
|
|
106
|
+
clear<K extends TKey>(...prefixes: K[]): Promise<number>;
|
|
107
107
|
/**
|
|
108
108
|
* 派生出一个指定类型的缓存服务。
|
|
109
109
|
*/
|
package/lib/services/cache.js
CHANGED
|
@@ -198,6 +198,10 @@ export class CacheService {
|
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
async remove(...keys) {
|
|
201
|
+
if (!keys.length) {
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
201
205
|
return x.redis.del(...keys.map(key => this.toRedisKey(key)));
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
@@ -220,6 +224,10 @@ export class CacheService {
|
|
|
220
224
|
|
|
221
225
|
|
|
222
226
|
async clear(...prefixes) {
|
|
227
|
+
if (!prefixes.length) {
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
223
231
|
const keys = (await Promise.all(prefixes.map(prefix => x.redis.keys(`${this.toRedisKey(prefix)}*`)))).flat();
|
|
224
232
|
|
|
225
233
|
if (keys.length) {
|