What's the best way to cache data from D1 used by a api request via workers? I need simple data from

What's the best way to cache data from D1 used by a api request via workers?
I need simple data from the D1 database like userCount via a api request, but quering the database on each request doesn't seem optimal.
Is there a way to save the data in some global variable or some caching mechanism so the d1 database isn't queried often?
Was this page helpful?