Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.
```