feat(cache): use vim.cache everywhere. poly-fill when needed

This commit is contained in:
Folke Lemaitre 2023-03-14 19:45:22 +01:00
parent 4446d69c28
commit ea1a044e3c
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 14 additions and 15 deletions

View file

@ -33,15 +33,20 @@ function M.setup(spec, opts)
end
local start = vim.loop.hrtime()
-- load module cache before anything else
-- poly-fill vim.cache
if not vim.cache then
vim.cache = require("lazy.core.cache")
end
local enable_cache = not (
opts
and opts.performance
and opts.performance.cache
and opts.performance.cache.enabled == false
)
-- load module cache before anything else
if enable_cache then
require("lazy.core.cache").enable()
vim.cache.enable()
end
require("lazy.stats").track("LazyStart")
@ -53,7 +58,7 @@ function M.setup(spec, opts)
table.insert(package.loaders, 3, Loader.loader)
if vim.g.profile_loaders then
require("lazy.core.cache").profile_loaders()
vim.cache.profile_loaders()
end
Util.track({ plugin = "lazy.nvim" }) -- setup start