Extract method to get cache name
Remove if/else/elseif by early returns
Add debug message for clearing/flushing cache