Cached files are, for all intents and purposes, free memory. I don't want to get too technical here (I can explain more if anyone is curious), but essentially, Mac OS is going to try to fill unused RAM with anything that it can cache in order to try to make the best use of it, but it will just start purging the cache once the RAM is actually needed for something more important.
You don't want to purge the cache manually, it contains a lot of pages from the disk (cached files) that belong to applications you might have opened recently, or might open in the future, etc. Mac OS will manage all of that for you, it will clear it out any time it needs to and there is no action that is required from you. In fact, trying to clear it manually yourself might actually worsen performance rather than helping it.
Also, memory pressure generally is a much better figure to look at than the actual "memory used" number on Mac OS. This is because MacOS is a bit weird with the way it manages memory and can be confusing with the way it reports usage (it can make it appear that the system is more memory starved than it actually is). Memory pressure usually gives you a much clearer picture of what's actually going on.
- Green memory pressure means you have plenty of memory available and are nowhere near your limit (no matter what Activity monitor says with regards to "in use memory").
- Yellow means you're getting closer to your limit. You still have memory available, but MacOS has made this possible by compressing and swapping data more aggressively. Most workloads generally still run fine in the yellow.
- Red means you do not have enough memory for the workload you are running, and your system will have major performance slowdowns.
Apple's support pages have some good documentation on some of this as well:
-
Memory Pressure
-
Activity Monitor RAM reporting