You'll learn it when it becomes a problem.
What kind of problems does one run into if they don't understand CPU cache?
It is useful when discussing the performance characteristics of various algorithms. For example, In java, you'll often see people recommend that LinkedList should be used everywhere. Why do they recommend this? Because they (mistakenly) believe that the O(1) insertion time is ideal (after all, O(1) is really fast, right?) On top of that, insertion into an ArrayList will possibly mean that everything gets copied, so, why would you use that? All of the other performance characteristics are roughly the same right?
Well, wrong, ArrayLists are almost always faster than LinkedLists, even in cases of end insertion and middle insertion. In fact, it takes a pretty big list of elements to get to the point where LinkedList performance overtakes ArrayList performance (and that number grows every day. Right now on our local systems it is in the millions). These differences are almost completely due to the nature of CPU caching.
But it goes deeper than that, (especially in java). The classic example is this, you want to store an array of Points (with an x, y, and z component) what is the fastest way to do this?
Well, currently, it is this ugly beast
Code:
int[] xs; int[] ys; int[] zs;
and not this
Code:
class Point{ int x; int y; int z }; Point[] points
Why is that? Because in java all objects introduce a second level of indirection which can result in the memory being accessed in unpredictable ways (which kills cache performance).
This problem, in particular, is the whole reason Java 9 (or 10?) is thinking about adding value types. And interestingly enough, some of the java garbage collectors do locality optimizations and memory defragmentation just for this reason (though, it is somewhat lacking).
So where would you need this? Well, you'll know when you need it if you are profiling down and trying to improve the performance somewhere. But just knowing about it might change the way you structure some code to be more cache friendly. Cache friendly stuff isn't often that much more complex than cache hating code.