refactor cache_method decorator