add local and redis cache code