MCPcopy Index your code
hub / github.com/antfu/cache-async-fn

github.com/antfu/cache-async-fn @v0.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.3 ↗ · + Follow
10 symbols 21 edges 3 files 7 documented · 70% updated 4y agov0.0.3 · 2022-06-29★ 88
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

async-cache-fn

NPM version

Usage

import { asyncCacheFn } from 'async-cache-fn'

export const getData = asyncCacheFn(async (url) => {
  const data = await fetch(url)
  return await data.json()
})
const users = await getData('/users')
const posts = await getData('/posts')

// in other place, `/users` will only be requested once and the result will be cached.
const users2 = await getData('/users')

Sponsors

License

MIT License © 2022 Anthony Fu

Extension points exported contracts — how you extend this code

AsyncCacheFn (Interface)
(no doc)
src/index.ts
AsyncCacheOptions (Interface)
(no doc)
src/index.ts

Core symbols most depended-on inside this repo

delete
called by 4
src/index.ts
has
called by 4
src/index.ts
get
called by 2
src/index.ts
set
called by 2
src/index.ts
asyncCacheFn
called by 2
src/index.ts
clear
called by 1
src/index.ts
invoke
called by 0
src/index.ts
noCache
called by 0
src/index.ts

Shape

Method 7
Interface 2
Function 1

Languages

TypeScript100%

Modules by API surface

src/index.ts10 symbols

For agents

$ claude mcp add cache-async-fn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page