(key, ...fields)
| 174 | } |
| 175 | |
| 176 | async hdel(key, ...fields) { |
| 177 | const hash = this.hashes.get(key); |
| 178 | if (!hash) return 0; |
| 179 | |
| 180 | let removedCount = 0; |
| 181 | fields.forEach((field) => { |
| 182 | if (hash.delete(field)) { |
| 183 | removedCount += 1; |
| 184 | } |
| 185 | }); |
| 186 | |
| 187 | if (hash.size === 0) { |
| 188 | this.hashes.delete(key); |
| 189 | } |
| 190 | |
| 191 | return removedCount; |
| 192 | } |
| 193 | |
| 194 | async hget(key, field) { |
| 195 | const hash = this.hashes.get(key); |
no test coverage detected