I want to store some intermediate results in cache on file system.
On Linux I can use simple
cache_dir = getenv("HOME") + "/.cache/my_program_dir"
What would be similar location on Windows and how to access (which environment variables etc)
$HOME would be "USERPROFILE". You may create your cache there, just like you do in Linux (inside .cache, that is).
However, there can be an alternative location, accessed via "LOCALAPPDATA". If you put a folder for "my_program" there, you can organize it like you please. Be sure, however, that the actual name of "my_program" is sufficiently unique.