@hile/cache 2.0.6 → 2.1.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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -53,11 +53,12 @@ export class RedisCache {
53
53
  async _read(target, params) {
54
54
  const key = this.makeKey(target.key, params);
55
55
  const redis = this.redis;
56
- const exists = await redis.exists(key);
57
- if (!exists)
58
- return await this._write(target, params);
59
56
  if (target.fieldable) {
60
57
  const fields = await redis.hgetall(key);
58
+ if (!fields)
59
+ return await this._write(target, params);
60
+ if (Object.keys(fields).length === 0)
61
+ return await this._write(target, params);
61
62
  return fields;
62
63
  }
63
64
  const text = await redis.get(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/cache",
3
- "version": "2.0.6",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -23,5 +23,5 @@
23
23
  "dependencies": {
24
24
  "ioredis": "^5.11.0"
25
25
  },
26
- "gitHead": "a1b2b073ea45f0504bc24ce7eb4899cb4d517192"
26
+ "gitHead": "7903ae989bd001d1ed1437cb90c9e828a1909061"
27
27
  }