Refactor cache handler
Basic auth handler