Added cache cleaning for expired cache, changed function generate filename location.