I don't think you should have to worry about the disk space being used by this. macOS should be treating that sort of thing as "Purgable", so if you are ever running low on space, macOS would automatically be able to remove that data to give you operational space back. So as far as space you can use on the disk, you should be able to consider the space currently used by that as free.
If it's a real bother though, your last option could be modified a little for reliability, which may solve the problem, depending on the Mac you have.
Basically, you could get a USB drive or SD Card of adequate size (also taking into consideration likely future needs, so say 32GB, or maybe 64GB, depends how many photos you take) and have it permanently connected. Instead of a Symlink, you could use macOS's fstab to cause the drive to use the
com.apple.iLifeMediaBrowser.ILPhotosTranscodeCache folder as it's mount point, both on boot and automatically when reconnected if it is ever removed while your system is running
A caveat of course, is that if your Mac is a portable, and you do take it places with you, this will be less convenient, since you still have to reconnect that drive every time you boot up. A Nifty Drive or JetDrive would solve this if it is a MacBook model with a SD slot and you don't use the slot... You can also get USB drives quite small now-a-days, think the size of a Logitech "Unified" wireless keyboard/mouse adapter, so you could safely leave that connected with a notebook, and it wouldn't be in the way on the back of a desktop, aside from of course having one less USB port.
To do this, you would want to format the external drive/card to match the format of your internal drive.
With the newly created partition selected in Disk Utility, click the Info button (letter i in a circle) on the top right of the window, and then find the FileSystem UUID. Click on it, copy it with Command-V, and onwards to the Terminal!
In Terminal, you'll need to run the
vifs command as root, using
vifs uses the
vi text editor to modify fstab, after locking it so nothing damages it. If you don't know how to use
vi for text editing, type
:h and then the return key to get to the help text. It explains editing much better than I can 😊
In short, use the arrow keys to get to the bottom empty line below the warning text about being careful with fstab, then type
:i to enter insert mode, and type:
UUID=<Your Filesystem UUID Here> /Users/<Your Home Folder Here>/Library/Containers/com.apple.MediaLibraryService/Data/Library/Caches/com.apple.iLifeMediaBrowser.ILPhotosTranscodeCache hfs rw
Replace HFS with whatever filesystem you formatted it as.
Exit Insert Mode with the ESC key, and type
:wq to write your changes and quit. If you want to quit and discard your changes, type
After this, eject the drive/card, delete the contents of the cache folder and then insert the drive again. Should mount to that location and macOS will start dumping the cache data there again.
- Frees up space on internal drive permanently, while keeping that cache accessible for apps that may use it (you never know, you might just start)
- Fails gracefully if you remove the drive/card, as macOS will just act like when you deleted the contents and re-create the cache. When you re-attach the drive, it will mount back to the original location again, where-as with a symlink you may need to create the symlink all over again (depends if it was a clean unmount, and what happens when macOS tries to write through a broken symlink I guess, I'm not sure if it will destroy the symlink and change it back to a normal folder or just stop with an error
- Will always be mounted during startup, so it will be there from Boot to Shutdown for macOS to send data to
- One external drive could be used for multiple caches, if there are others you want a similar space saving from, but you would need a partition per cache. If you're using APFS on the external drive, this won't be a problem, as all APFS Partitions share the total storage of their drive (I do this with my Plex server's Transcode cache and Mobile Sync cache to spare partitions on my DAS, cause they just get so gorram big!)
- Not likely to be great if you use a NoteBook, unless you invest in a tiny USB drive or a form-fitted SD Card such as Nifty Drive or JetDrive
- Requires more hardware you may need to purchase
- Not 100% sure how macOS will react if you have a partially rebuilt cache in the library folder after the drive is disconnected, and then re-connect the drive/card and it mounts as the cache folder. My Plex caches haven't had a problem with that happening before since they don't re-populate when cleared until next time I'm watching/syncing something, but the macOS one might be interesting since it would start rebuilding straight away. Hopefully it would just delete what's in the cache at that point, or move it to the external drive/card. You might want to test that early on to see what happens
- You lose a USB port or a SD Slot, which may or may not be an issue, that depends on your needs
Again, macOS should dump those caches automatically if you ever actually need the cache, so you probably don't HAVE to do any of this, but if you really really want the space back, that is how I've done it on mine (Plex doesn't mark it's caches as pursuable for macOS, so it's this or manually clear them every now and then for me...)