{"version":"1.0","type":"rich","title":"async-cache-0.js","description":"This example demonstrates a caching mechanism for asynchronous functions, showing how repeated calls can bypass a slow database lookup. It defines `cachify`, a wrapper that takes an original async function and a cache-fetching function, returning a new function to use instead. The code uses `setTimeout` to simulate random 1–2 second database delays and a near-instant cache response, with data stored in a plain in-memory `users` object. The example compares timing via `console.time` and `console.timeEnd`, illustrating the performance difference between direct database access and cached retrieval.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-991a054c4ff4561fc5a1?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}