Environment
unstorage@1.9.0, node v20.9.0
Reproduction
Currently getKeys and clear behave differently when they are passed a prefix.
const prefix = 'test';
let keys = await storage.getKeys(prefix);
console.log(keys); // ['test:123', 'test:abc']
await storage.clear(prefix);
keys = await storage.getKeys(prefix);
console.log(keys); // ['test:123', 'test:abc']
clear seems to ignore the prefix if it is not a mount, while getKeys finds all keys which begin with the prefix. Since the options are named the same I had assumed they would behave similarly.
Describe the bug
Is this behavior intentional? Currently I'm working around it by individually deleting keys, but it would be nice if clear also worked.
const prefix = 'test';
let keys = await storage.getKeys(prefix);
console.log(keys); // ['test:123', 'test:abc']
await Promise.all(keys.map((k) => this.storage.removeItem(k)));
keys = await storage.getKeys(prefix);
console.log(keys); // []
Additional context
No response
Logs
No response
Environment
unstorage@1.9.0, node v20.9.0
Reproduction
Currently
getKeysandclearbehave differently when they are passed a prefix.clearseems to ignore the prefix if it is not a mount, whilegetKeysfinds all keys which begin with the prefix. Since the options are named the same I had assumed they would behave similarly.Describe the bug
Is this behavior intentional? Currently I'm working around it by individually deleting keys, but it would be nice if
clearalso worked.Additional context
No response
Logs
No response