Skip to Content
The Public InterfaceSeptember 12, 2026

The Public Interface

November 12, 2025

Simple Memoization in TypeScript

A tiny class to memoize a function in TS.

By Ross Robinomemo / cache / javascript

JavaScript isn’t the fastest language, it’s best to make sure repeated async operations and expensive computations aren’t done repeatedly. Here’s a Memo class that ensures whether it be an async function that has latency, or an expensive mathematical computation, the same operations are not running multiple times.

This memo class creates a trie for each function using each argument it is called with. Async calls link to the same result so they are not called twice even if the async call hasn’t completed yet!

If you are memoizing on a web server, be sure to create the memo instance within the scope of the request or in AsyncLocalStorage if you are caching sensitive data.…

Continue reading

In brief

Fast Response Times with ETags

How to use ETags in server-side JavaScript to speed up your website.

When creating a web application, a common performance optimization is to save many of the files that are required to run your application on users’ devices so that the next time they visit the page it will load faster. This is called caching, you can open your browser cache and see all of the different assets that have been saved to your computer. For each Response sent from your application, you can set headers in the Response that tell the browser to cache the request in various ways.

October 8, 2024