@jayfong/x-server 2.1.5 → 2.1.6

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.
@@ -33,11 +33,11 @@ class CacheService {
33
33
 
34
34
 
35
35
  async set(key, value, ttl = this.options.ttl) {
36
- const redisKey = this.toRedisKey(key);
37
- const redisValue = JSON.stringify(value);
38
36
  const redisTtl = typeof ttl === 'function' ? ttl(value, this.options.ttl) : ttl;
39
37
 
40
38
  if (redisTtl) {
39
+ const redisKey = this.toRedisKey(key);
40
+ const redisValue = JSON.stringify(value);
41
41
  await _x.x.redis.set(redisKey, redisValue, // 毫秒
42
42
  'PX', (0, _date.ms)(redisTtl));
43
43
  }
@@ -23,11 +23,11 @@ export class CacheService {
23
23
 
24
24
 
25
25
  async set(key, value, ttl = this.options.ttl) {
26
- const redisKey = this.toRedisKey(key);
27
- const redisValue = JSON.stringify(value);
28
26
  const redisTtl = typeof ttl === 'function' ? ttl(value, this.options.ttl) : ttl;
29
27
 
30
28
  if (redisTtl) {
29
+ const redisKey = this.toRedisKey(key);
30
+ const redisValue = JSON.stringify(value);
31
31
  await x.redis.set(redisKey, redisValue, // 毫秒
32
32
  'PX', ms(redisTtl));
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",