created makeCache function with comments

also tested the function and it seems to be working