From 856ab9e476e501b7e1d02299604c19e12e5a1cc8 Mon Sep 17 00:00:00 2001
From: Folke Lemaitre <folke.lemaitre@gmail.com>
Date: Mon, 13 Feb 2023 11:58:09 +0100
Subject: [PATCH] feat(cache): allow to disable the cache

---
 lua/lazy/core/config.lua | 5 +++--
 lua/lazy/init.lua        | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua
index be06062..bc8257b 100644
--- a/lua/lazy/core/config.lua
+++ b/lua/lazy/core/config.lua
@@ -113,8 +113,9 @@ M.defaults = {
     notify = true, -- get a notification when changes are found
   },
   performance = {
-    ---@type LazyCacheConfig
-    cache = nil,
+    cache = {
+      enabled = true,
+    },
     reset_packpath = true, -- reset the package path to improve startup time
     rtp = {
       reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
diff --git a/lua/lazy/init.lua b/lua/lazy/init.lua
index df05824..e81c4ec 100644
--- a/lua/lazy/init.lua
+++ b/lua/lazy/init.lua
@@ -34,7 +34,9 @@ function M.setup(spec, opts)
   local start = vim.loop.hrtime()
 
   -- load module cache before anything else
-  require("lazy.core.cache").enable()
+  if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then
+    require("lazy.core.cache").enable()
+  end
 
   require("lazy.stats").track("LazyStart")