Cache and WAL differrence, and where from data comes into WAL

Hi
I am new to Influx,
Can anyone pls tell me the difference between cache and WAL, and from where does the data gets flushed into WAL file.