fs_fetch_value_cache.ts

view source

Declarations
#

2 declarations

create_fs_fetch_value_cache
#

fs_fetch_value_cache.ts view source

(name: string, dir?: string): Promise<FetchCache> import {create_fs_fetch_value_cache} from '@fuzdev/fuz_repos/fs_fetch_value_cache.js';

Creates file-system backed cache for fuz_util's fetch.js API responses.

Cache invalidation strategy: If cache file can't be read or parsed, entire cache is cleared (delete file) and starts fresh. This handles format changes.

Uses structuredClone to track changes - only writes to disk if data modified. Formatted with gro's format_file before writing for version control friendliness.

name

cache filename (without .json extension)

type string

dir

cache directory (defaults to .gro/build/fetch/)

type string
default join(paths.build, 'fetch')

returns

Promise<FetchCache>

cache object with Map-based data and save() method

FetchCache
#

fs_fetch_value_cache.ts view source

FetchCache import type {FetchCache} from '@fuzdev/fuz_repos/fs_fetch_value_cache.js';

name

type string

data

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }>

save

type (): Promise<boolean>

returns Promise<boolean>

true if anything changed, false if no-op

Imported by
#