Sets a maximum age (minimum one day) for script storage values, after which they are deleted
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/562172/1733898/Temporary-Script-Storage.js
範例用法:
const persistentStorage = new TTLStorage();
await persistentStorage.ready();
setInterval(() => persistentStorage.sweepExpiredEntries(), 1000 * 60 * 60 * 24);
await persistentStorage.set("key1", "hello");
const msg = persistentStorage.get("key1");