@jayfong/x-server 2.17.0 → 2.17.2

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.
@@ -70,7 +70,11 @@ class CacheService {
70
70
  const gotValue = await _x.x.redis.get(redisKey);
71
71
  if (gotValue) {
72
72
  try {
73
- return JSON.parse(gotValue);
73
+ const parsedValue = JSON.parse(gotValue);
74
+ if (this.options.memory) {
75
+ this.memoryCache.set(redisKey, parsedValue);
76
+ }
77
+ return parsedValue;
74
78
  } catch {}
75
79
  }
76
80
  return null;
@@ -42,7 +42,8 @@ class CaptchaService {
42
42
  text: code,
43
43
  data: svg
44
44
  } = _svgCaptcha.default.create({
45
- size: payload.size
45
+ size: payload.size,
46
+ charPreset: this.charsetMap[payload.charset].join('')
46
47
  });
47
48
  const token = await _x.x.cache.save({
48
49
  code,
@@ -65,7 +65,11 @@ export class CacheService {
65
65
  const gotValue = await x.redis.get(redisKey);
66
66
  if (gotValue) {
67
67
  try {
68
- return JSON.parse(gotValue);
68
+ const parsedValue = JSON.parse(gotValue);
69
+ if (this.options.memory) {
70
+ this.memoryCache.set(redisKey, parsedValue);
71
+ }
72
+ return parsedValue;
69
73
  } catch {}
70
74
  }
71
75
  return null;
@@ -37,7 +37,8 @@ export class CaptchaService {
37
37
  text: code,
38
38
  data: svg
39
39
  } = svgCaptcha.create({
40
- size: payload.size
40
+ size: payload.size,
41
+ charPreset: this.charsetMap[payload.charset].join('')
41
42
  });
42
43
  const token = await x.cache.save({
43
44
  code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.17.0",
3
+ "version": "2.17.2",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",