Hi all,
I'm struggling with how to maintain a persistent process within Payload CMS. We have a computationally heavy task whose result I’d like to cache in memory. To achieve this, I created a plugin that starts a bentoCache instance inside onInit, and I then use that cache in a custom API endpoint.
However, especially in development, I’ve noticed that despite my safeguards to prevent recreation, Next.js seems to reload the plugin multiple times while I'm navigating the site. This ends up recreating the bentoCache instance and purging the previous data.
It’s been a few years since I’ve used Node.js, and this is my first time working with Payload. I’m hoping this is just a trivial usage issue — or is this kind of caching just not feasible without an external store like Redis?
Thanks in advance for any insight!