From c540ba3050cb2f81a5e6f6a97398f30f5e47c4af Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 19 Sep 2025 20:44:45 -0400 Subject: [PATCH] feat(cache): optimize cache loading --- lua/cp/cache.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/cp/cache.lua b/lua/cp/cache.lua index 0caf50d..4f339a4 100644 --- a/lua/cp/cache.lua +++ b/lua/cp/cache.lua @@ -61,14 +61,20 @@ local function is_cache_valid(contest_data, platform) end function M.load() + if loaded then + return + end + if vim.fn.filereadable(cache_file) == 0 then cache_data = {} + loaded = true return end local content = vim.fn.readfile(cache_file) if #content == 0 then cache_data = {} + loaded = true return end @@ -78,6 +84,7 @@ function M.load() else cache_data = {} end + loaded = true end function M.save()