This message was deleted.
# ask-questions
w
This message was deleted.
f
Hi Joshua
Let me get you some example code
b
I wouldn’t want to hit your API on every api hit to my page. But I also want to refresh my features every X minutes. I’m googling around and new to node & express, and don’t know the best practices for having a background thread call
setFeatures
f
the caching can be done any way you like, here is one that looks like it will work: https://dev.to/franciscomendes10866/simple-in-memory-cache-in-node-js-gl4
b
I ended up going with a node-cron approach. snippet shared
maybe it is useful for someone else.
f
nice, do you mind if I use that... great 🙂
b
You fire that function at boot, and it goes and does its thing.
f
on line 9 it seems to do the fetch regardless, no?
b
I don’t want the app to start without fetching the features first. That cron won’t fire for a minute.
143 Views