Spaces:
Running
Running
Download 731ai/node_modules/pdf-lib/src/utils/Cache.ts from u11310019/interactive-multi-web: direct link, hf CLI and curl.
- Browser
- Download file 507 Bytes
-
https://huggingface.co/spaces/u11310019/interactive-multi-web/resolve/main/731ai/node_modules/pdf-lib/src/utils/Cache.ts
- Command line
-
hf download hf://spaces/u11310019/interactive-multi-web/731ai/node_modules/pdf-lib/src/utils/Cache.ts
-
curl -L -o Cache.ts https://huggingface.co/spaces/u11310019/interactive-multi-web/resolve/main/731ai/node_modules/pdf-lib/src/utils/Cache.ts
507 Bytes
| class Cache<T> { | |
| static readonly populatedBy = <T>(populate: () => T) => new Cache(populate); | |
| private readonly populate: () => T; | |
| private value: T | undefined; | |
| private constructor(populate: () => T) { | |
| this.populate = populate; | |
| this.value = undefined; | |
| } | |
| getValue(): T | undefined { | |
| return this.value; | |
| } | |
| access(): T { | |
| if (!this.value) this.value = this.populate(); | |
| return this.value; | |
| } | |
| invalidate(): void { | |
| this.value = undefined; | |
| } | |
| } | |
| export default Cache; | |