Add caching for #commit_line method