ITADN

this.remote._getKeyPrefix is not a function.

#220Closedentrptaher 创建于 2025-04-03
E
entrptahercommented
When we test this with a clean installation with `@keyvhq/multi`, we face this issue. ```ts const cache = new KeyvMulti({ local: new Map(), remote: new Map() }) // or const cache = new Keyv({ prefix: 'asset-cache:', store: new KeyvMulti({ local: new Map(), remote: new Map() }) }) ``` Error: ```ts 20 | 21 | async get (...args) { 22 | let res = await this.local.get(...args) 23 | 24 | if (res === undefined || !this.validator(res, ...args)) { 25 | const key = this.remote._getKeyPrefix(...args) ^ TypeError: this.remote._getKeyPrefix is not a function. (In 'this.remote._getKeyPrefix(...args)', 'this.remote._getKeyPrefix' is undefined) ``` The only way is the following, ```ts new KeyvMulti({ local: new Map(), remote: new Keyv({ store: new KeyvFile('./cache-asset') }) }) ``` It seems the remote stores are not updated with the Keyv core function. So either updating the docs, or the code is going to be helpful.
关闭于 2025-04-04 1 条评论