Cachet Changelog

This will be used for news or changes for Cachet so that you can use the “Watch” feature and keep up to date without getting notifications for questions and whatnot.

image

Inspired by DataStore2

I made a bug fix to Cachet just now. Previously Cachet would throw an error if you failed to include any defaultValues when creating your cache, that has now been fixed.

Please make sure you update your copy of Cachet. There are no changes required to your own code unless you’ve forked Cachet.

How to update if you've forked cachet

Around line 57 in Cachet.new, the module will loop through all of the defaultValues and run the store function on them.

for key, value in pairs(defaultValues) do
    cache:store(key, value)
end

To prevent this bug, please wrap this loop with if defaultValues then. In the end, it should look like this:

if defaultValues then
     for key, value in pairs(defaultValues) do
        cache:store(key, value)
    end
end

And the full Cachet.new method should lok like this:

--[[
	Creates, prepares, and returns a new cache object.
]]
function Cachet.new(defaultValues)
	assert(defaultValues == nil or typeof(defaultValues) == "table", BAD_TYPE:format(1, "Cachet.new", "table", typeof(defaultValues)), 2)
	
	local cache = setmetatable({
		data = {},
		event = Instance.new("BindableEvent")
	}, Cachet)
	
	if defaultValues then
		for key, value in pairs(defaultValues) do
			cache:store(key, value)
		end
	end
	
	return cache
end