cheatcode / joystick

A full-stack JavaScript framework for building stable, easy-to-maintain apps and websites.
https://cheatcode.co/joystick
Other
209 stars 11 forks source link

Have a way to cache data to the process in memory #367

Closed rglover closed 2 months ago

rglover commented 10 months ago

Just a thought while writing a query for some data that could be globally cached. It's a bit risky due to memory constraints, but it'd be nice to be able to have a database query that runs on startup and populates an in-memory cache somewhere like process.databases.caches.<cache_name>.

That way, for example, if I reuse the same data over and over again (like a list of users with a role), I can set the cache once and then just read from that in my code (and if I want to update it, I can just run a cron to patch the cache on some interval).

rglover commented 2 months ago

This is done, I just need to document how it works.

rglover commented 2 months ago

Done.