Skip to content

PromptScript API


Class: GitCacheManager

Defined in: resolver/src/git-cache-manager.ts:84

Manager for Git repository cache.

Constructors

Constructor

new GitCacheManager(options): GitCacheManager

Defined in: resolver/src/git-cache-manager.ts:88

Parameters

options

GitCacheManagerOptions = {}

Returns

GitCacheManager

Methods

cleanupStale()

cleanupStale(): Promise\<number>

Defined in: resolver/src/git-cache-manager.ts:249

Remove all stale cache entries.

Returns

Promise\<number>

Number of entries removed


clear()

clear(): Promise\<void>

Defined in: resolver/src/git-cache-manager.ts:263

Remove all cache entries.

Returns

Promise\<void>


get()

get(url, ref): Promise\<CacheEntry | null>

Defined in: resolver/src/git-cache-manager.ts:124

Get a cache entry if it exists.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

Returns

Promise\<CacheEntry | null>

Cache entry or null if not found


getCachePath()

getCachePath(url, ref): string

Defined in: resolver/src/git-cache-manager.ts:100

Get the cache directory for a given URL and ref.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

Returns

string

Path to the cache directory


getSize()

getSize(): Promise\<number>

Defined in: resolver/src/git-cache-manager.ts:274

Get the total size of the cache in bytes.

Returns

Promise\<number>

Total cache size in bytes


isValid()

isValid(url, ref): Promise\<boolean>

Defined in: resolver/src/git-cache-manager.ts:112

Check if a cache entry exists and is not stale.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

Returns

Promise\<boolean>

True if cache is valid (exists and not stale)


list()

list(): Promise\<CacheEntry[]>

Defined in: resolver/src/git-cache-manager.ts:219

List all cache entries.

Returns

Promise\<CacheEntry[]>

Array of cache entries


remove()

remove(url, ref): Promise\<void>

Defined in: resolver/src/git-cache-manager.ts:206

Remove a cache entry.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

Returns

Promise\<void>


set()

set(url, ref, commitHash): Promise\<string>

Defined in: resolver/src/git-cache-manager.ts:153

Create or update a cache entry.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

commitHash

string

Current commit hash

Returns

Promise\<string>

Path to the cache directory


touch()

touch(url, ref, commitHash?): Promise\<void>

Defined in: resolver/src/git-cache-manager.ts:184

Update the lastUpdated timestamp for an existing cache entry.

Parameters

url

string

Git repository URL

ref

string

Git ref (branch/tag/commit)

commitHash?

string

Optional new commit hash (if fetch resulted in update)

Returns

Promise\<void>