feat: 在storage-manager添加keys方法

master^2
layhuts 2026-05-09 10:58:41 +08:00
parent 329fa68207
commit 8ce773f264
1 changed files with 12 additions and 0 deletions

View File

@ -71,6 +71,18 @@ class StorageManager {
return raw.value; return raw.value;
} }
/**
*
*/
async keys(): Promise<string[]> {
const allKeys = await this.driver.keys();
const fullPrefix = this.prefix ? `${this.prefix}-` : '';
if (!fullPrefix) return allKeys;
return allKeys
.filter((key) => key.startsWith(fullPrefix))
.map((key) => key.slice(fullPrefix.length));
}
/** /**
* *
* @param key * @param key