It will not matter in relationship to ram V CPU cache.
What you should do is to buy the fastest ram your motherboard can support and then look to see if it supports dual channel mode. If it does match the ram for dual working.
As to the cache for a CPU, obviously the higher ammount of cache the better performance pound for pound for a simmilar cpu. A 2mb cache would usually give a dual core cpu being able to store 1Mb preload for each core. the 4Mb will be 2Mb per core. The 8Mb will be 2Mb per core for a quad core cpu.
Buy the best cpu you can afford. If you are into gaming for the AMD, for raw cpu power go for the intel.