Skip to content

gaslamp


Class: CacheLedger

Singleton cache ledger for managing the shared cache instance.

Maintains a single JunkPocket instance across the GAS execution context, allowing multiple gasket instances to share cached resources without redundant API calls. The instance is automatically cleaned up when execution ends.

Example

TypeScript
const cache = CacheLedger.getInstance();
cache.set('sheet:123', sheetData);
const data = cache.get('sheet:123');

Constructors

Constructor

new CacheLedger(): CacheLedger

Returns

CacheLedger

Methods

getInstance()

static getInstance(): JunkPocket\<unknown>

Gets or creates the singleton JunkPocket instance.

Returns the existing instance if available, or creates a new one on first access.

Returns

JunkPocket\<unknown>

The singleton JunkPocket instance shared across the execution context.

Example

TypeScript
const cache = CacheLedger.getInstance();