getinstancecache

Gets all cached instance references.

Syntax

getinstancecache() -> table

Returns

TypeDescription
tableDictionary of cached instances

Description

getinstancecache returns the internal instance cache. Keys are light userdata values and each value is its corresponding Instance.

Example

local instanceCache = getinstancecache()
local count = 0

for key, instance in pairs(instanceCache) do
    count += 1
    print(key, instance)
end

print("Cached instances:", count)

-- This is the same table used by the cache library
local folder = Instance.new("Folder")
print(cache.iscached(folder)) -- true
folder:Destroy()