@jayfong/x-server 2.7.0 → 2.8.1

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.
@@ -99,6 +99,18 @@ class CacheService {
99
99
  }
100
100
  });
101
101
  }
102
+ /**
103
+ * 获取距离过期时间的毫秒数(未设置过期时间返回-1,键不存在返回-2)。
104
+ *
105
+ * @param key 键
106
+ * @returns 返回距离过期时间的毫秒数
107
+ */
108
+
109
+
110
+ async ttl(key) {
111
+ const redisKey = this.toRedisKey(key);
112
+ return _x.x.redis.pttl(redisKey);
113
+ }
102
114
  /**
103
115
  * 缓存内容。
104
116
  *
@@ -52,6 +52,13 @@ export declare class CacheService<TData extends Data = Data, TKey extends Key<TD
52
52
  * @returns 返回获取到的缓存内容
53
53
  */
54
54
  getMany<K extends TKeyPath, V extends Value<TData, K>>(...keys: K[]): Promise<Array<V | null>>;
55
+ /**
56
+ * 获取距离过期时间的毫秒数(未设置过期时间返回-1,键不存在返回-2)。
57
+ *
58
+ * @param key 键
59
+ * @returns 返回距离过期时间的毫秒数
60
+ */
61
+ ttl<K extends TKeyPath>(key: K): Promise<number>;
55
62
  /**
56
63
  * 缓存内容。
57
64
  *
@@ -89,6 +89,18 @@ export class CacheService {
89
89
  }
90
90
  });
91
91
  }
92
+ /**
93
+ * 获取距离过期时间的毫秒数(未设置过期时间返回-1,键不存在返回-2)。
94
+ *
95
+ * @param key 键
96
+ * @returns 返回距离过期时间的毫秒数
97
+ */
98
+
99
+
100
+ async ttl(key) {
101
+ const redisKey = this.toRedisKey(key);
102
+ return x.redis.pttl(redisKey);
103
+ }
92
104
  /**
93
105
  * 缓存内容。
94
106
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.7.0",
3
+ "version": "2.8.1",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@fastify/formbody": "^6.0.0",
30
30
  "@fastify/websocket": "^7.0.1",
31
- "@prisma/client": "^4.8.0",
31
+ "@prisma/client": "^4.16.2",
32
32
  "@types/bull": "^3.15.8",
33
33
  "@types/busboy": "^0.3.2",
34
34
  "@types/cron": "^2.0.0",
@@ -45,8 +45,8 @@
45
45
  "cron": "^2.0.0",
46
46
  "cuid": "^2.1.8",
47
47
  "debug": "^4.3.4",
48
- "esbuild": "^0.14.36",
49
- "esbuild-register": "^3.3.2",
48
+ "esbuild": "^0.18.11",
49
+ "esbuild-register": "^3.4.2",
50
50
  "execa": "^5.1.1",
51
51
  "exit-hook": "^2.2.1",
52
52
  "fast-xml-parser": "^3.21.1",
@@ -65,7 +65,7 @@
65
65
  "node-ssh": "^12.0.4",
66
66
  "nodemailer": "^6.7.3",
67
67
  "pino-pretty": "^7.6.1",
68
- "prisma": "^4.8.0",
68
+ "prisma": "^4.16.2",
69
69
  "select-run": "^1.1.2",
70
70
  "supports-color": "^8",
71
71
  "svg-captcha": "^1.4.0",