Method
keys
(appendCriteria?: string)
Source from the content-addressed store, hash-verified
| 96 | } |
| 97 | |
| 98 | async keys(appendCriteria?: string) { |
| 99 | try { |
| 100 | const match = `${this.buildKey('')}${appendCriteria ? `${appendCriteria}:` : ''}*`; |
| 101 | const keys = []; |
| 102 | for await (const key of this.client.scanIterator({ |
| 103 | MATCH: match, |
| 104 | COUNT: 100, |
| 105 | })) { |
| 106 | keys.push(key); |
| 107 | } |
| 108 | |
| 109 | return [...new Set(keys)]; |
| 110 | } catch (error) { |
| 111 | this.logger.error(error); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | buildKey(key: string) { |
| 116 | return `${this.conf?.PREFIX_KEY}:${this.module}:${key}`; |
Tested by
no test coverage detected