The log files are not cached by MySQL Server. They may be partially cached by the operating system, as any buffered I/O is cached. But this is flushed to disk promptly by the OS.
Some releases of MySQL 8.0.x have reported memory leaks, i.e. memory is allocated but not freed, and the process grows over time. Perhaps none of the queries or other operations are especially high consumers of RAM, but as time goes on they incrementally "waste" more and more RAM. Restarting the MySQL Server process resets all RAM, so this explains why you didn't notice it while you were doing weekly restarts.
Memory leaks are bugs. They shouldn't happen in a properly engineered product. MySQL Server has unfortunately had some of these bugs, and you can search https://bugs.mysql.com for bugs reporting memory leaks that affect the version of MySQL Server you use. You should go research that bugs database.
If you find a bug that has been fixed in a subsequent version of MySQL Server, then you may want to upgrade to get the fix.
If you find a bug that has not yet been fixed, you can click the "Affects Me" button on that bug screen and add your voice to help increase the priority of fixing the bug.
If you are a customer paying for a support contract with Oracle, you should talk to your support representative and ask if or when the bug will be fixed.
In the meantime, memory leaks are difficult to manage. You may have to return to your practice of restarting the MySQL Server when you see the RAM usage increasing.
You could also try to debug the RAM usage of MySQL Server yourself, and develop a fix for the code. MySQL is open source, so you can patch the code yourself, or even contribute your patch back to the project. But this is more work than most users of MySQL want to put in.
doing weekly MySQL restart
that's the problem. That only slows things, as the database has to load all cached data all over again. Database servers do use all available memory to cache data so they don't have to read from slow disks.Name LIKE '%banana%'
can't use indexes and has to load everything to find matches. A query withName LIKE 'banana%'
on the other hand can use indexes and only load matches. The server only caches the index data pages