Skip to content

Function: withCache()

withCache<C>(spreadsheet, cache, options): TSpreadsheet

Add caching capability to the spreadsheet object.

Type Parameters

Type Parameter
C extends TCacheAdapter

Parameters

ParameterTypeDescription
spreadsheetTSpreadsheetA spreadsheet object
cacheCA cache adapter
optionsWithCacheOptions-

Returns

TSpreadsheet

A spreadsheet object with underlying caching

Example

ts
const cache = new Map(); // Use Map as a simple in-memory cache
const sheets = withCache(Spreadsheet('google-sheets-id'), cache);
const output = sheets.get('sheet-name')

Defined in

src/plugin/cache.ts:51

Released under the MIT License.