How does file caching work?

Does Obsidian cache only markdown files, or every single file in the vault? When I add big folders (around 8000 files, mostly small graphics) into my obsidian vault, there’s noticable lag in the app and it completely freezes for a while when I try to click on the folder in the core navigation/file explorer. Is this potentially caused by Obsidian caching every one of those images?

I recently started making a plugin just to customise Obsidian to my taste, and if the lag can be fixed somehow I’d like to make a custom file explorer and use Obsidian for all of my documents. Also I like details :).

What exactly is laggy? Do you have any plugins enabled? Is it still laggy if you enable Restricted Mode?