cache_fullProcess_withDevCacheBust() — supabase Function Reference
Architecture documentation for the cache_fullProcess_withDevCacheBust() function in helpers.fs.ts from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/docs/features/helpers.fs.ts lines 12–44
export const cache_fullProcess_withDevCacheBust = <Args extends unknown[], Output>(
/**
* The function whose results to cache
*/
fn: (...args: Args) => OrPromise<Output>,
/**
* The directory to watch for edits
*/
watchDirectory: string,
/**
* A function that generates the cache key to bust, given the changed
* filename (relative to the watch directory)
*/
genCacheKeyFromFilename: (filename: string) => string
) => {
const _cache = new Map<string, Output>()
if (IS_DEV) {
watch(watchDirectory, { recursive: true }, (_, filename) => {
if (!filename) return
const cacheKey = genCacheKeyFromFilename(filename)
_cache.delete(cacheKey)
})
}
return async (...args: Args) => {
const cacheKey = JSON.stringify(args)
if (!_cache.has(cacheKey)) {
_cache.set(cacheKey, await fn(...args))
}
return _cache.get(cacheKey)!
}
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free