Tutorial request megathread

Understanding the lua cache and how to write an own cache in lua

It is still not documented, what things are required for reloading lua modules. For example,
if one runs :lua print(vim.inspect(package.loaded, { depth = 1 })) one can scroll through the modules.
However, there are neither pointers in the docs nor otherwise blogs on how the internal cache works.

More or less related, I did not find tutorials on how to do caching of function or command arguments with lua.