Why the cache exists and why it bites you
Google Sheets caches the return value of every custom function keyed against its exact arguments. If you call =MYFUNC(A2) and A2 does not change, Sheets returns the cached result without ever running your script again. That is by design: custom functions count against a per-spreadsheet execution quota (30 seconds per call, 30 minutes per day on the free tier), and Sheets protects that budget aggressively.
The cache becomes a problem the moment your function reads something that is not an argument — a URL, a named range, a value fetched from UrlFetchApp, or the current time. You change the external thing, nothing in the cell formula changes, Sheets never fires, and you stare at yesterday's number.
The first time I hit this I spent an hour debugging the script before realizing the script was never running at all. Ctrl+Alt+F9 (recalculate all formulas) forces it once, but that is a manual step, not a solution.