Easy caching of function and script output