Temporary-Script-Storage

Sets a maximum age (minimum one day) for script storage values, after which they are deleted

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/562172/1881822/Temporary-Script-Storage.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
JasonMel
Verzija
1.0.4
Napravljeno
11. 01. 2026
Ažurirano
21. 07. 2026
Size
31,2 КБ
Licenca
MIT (https://mit-license.org/)

Складиште постављено и приступљено кроз инстанцу ове класе ће постојати само док траје животни век који сте поставили у конструктору, иако мора бити барем један дан. Подразумевано је 30 дана. После тога ће истећи и бити обрисано када се позове sweepExpiredEntries(), што можете заказати са setInterval().

Ова библиотека нема никаквог утицаја на складиште скрипта постављено директно кроз GM setValue() на уобичајени начин. Такво складиште ће се понашати нормално.

Пример коришћења:

const persistentStorage = new TTLStorage();
await persistentStorage.ready();
setInterval(() => persistentStorage.sweepExpiredEntries(), 1000 * 60 * 60 * 24);

try { 
  await persistentStorage.set("key1", "hello"); // throws
  const msg = persistentStorage.get("key1");    // fast memory read
  await persistentStorage.delete("key1");       // throws
} catch {}

Поред тога, свaki скрипт који користи ову библиотеку мора садржавати следеће метаподатке:

// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @grant GM.listValues
// @grant GM.info

Ово је неопходно јер постављање онога што свака библиотека требa у своје метаподатке није довољно. Скрипта на вишој нивоу мора обезбедити неопходне @require и @grant за све своје зависности.