Fix for #4655: Make fftpack._raw_fft threadsafe

This patch replaces the naive dictionary-cache implementation in _raw_fft with an equivalent cache that will perform correctly in a multithreaded context.