Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rakannimer/with-fs-cache
Wrap any async method with a filesystem cache. Convenience methods around cache-manager and cache-manager-fs.
https://github.com/rakannimer/with-fs-cache
Last synced: 12 days ago
JSON representation
Wrap any async method with a filesystem cache. Convenience methods around cache-manager and cache-manager-fs.
- Host: GitHub
- URL: https://github.com/rakannimer/with-fs-cache
- Owner: rakannimer
- Created: 2018-08-07T09:35:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-19T11:31:06.000Z (over 6 years ago)
- Last Synced: 2024-12-16T22:13:41.899Z (2 months ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## with-fs-cache
Wrap any method, sync or async with a File System Cache.
## Usage
```typescript
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));const myID = await withFsCache(
// Can be anything
"my-id",
async () => {
await sleep(500);
functionCallCount += 1;
return { someData: "1" };
}
);// If called again it will return without waiting.
```