The Media Cache should be on storage that is fast, large, and has hundreds of GB of available space.
An M1 iMac has some of the fastest internal storage available, so usually the internal storage is a safe choice. But if the internal storage is running out of free space, that will cause performance problems and you would want to look at external storage for the Media Cache.
As far as I know, all WD MyBook external storage are hard drives, and possibly 5400RPM class hard drives. While that could fit the requirements of being large with a lot of free space, what disqualifies them completely is that a 5400RPM hard drive is some of the slowest storage you can get today, not suitable for an Adobe Media Cache.
The cheapest OK solution for external media cache storage is a SATA SSD connected with a USB 3, 5 gigabits per second cable to the iMac. This should be $100-150 and be around 5 times faster than a hard drive, but about 1/5 the speed of the storage inside an M1 iMac. Still, it can be an OK option if your After Effects projects aren’t too demanding.
The next higher option is a more compact NVMe SSD connected with a USB 3, 10Gb/sec cable to the iMac, up to 10 times faster than a hard drive or about half the speed of the storage inside an M1 iMac. $150-200 for 1TB.
The fastest but most expensive option is an NVMe SSD connected with a Thunderbolt 3 cable to the iMac. This option is up to 30 times faster than a hard drive, and closest in performance to the storage inside an M1 iMac. $250 and up for 1TB.