{"version":"1.0","type":"rich","title":"0-cache-second-try.js","description":"This example demonstrates a caching pattern that wraps an asynchronous database lookup with a cache check, showing how repeated requests can bypass the original slow operation. The code defines an in-memory `users` object and a `getUserFromDb` function that simulates a 1–2 second delay using `setTimeout`. The `cachify` helper composes the original function with `getResultFromCache`, which returns the same user data synchronously via a zero-millisecond timeout. Two `console.time` calls compare the direct database hit against the cached call, visually timing the difference in the console.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-e14cf75d7e2badeb9892?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}