cache. invalidate Synchronous
syn.cache_invalidate
Remove an Instance’s canonical wrapper from the ObjectBridge cache. The Instance itself remains alive; a later lookup may create a different wrapper for that same engine object.
Luau
cache.invalidate(instance: Instance) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
instance | Instance | The Instance whose cached wrapper should be removed. |
Returns
()No values.
Usage notes
Use compareinstances when two wrappers may refer to the same underlying Instance. Invalidating a shared wrapper can change which userdata is returned by later lookups.
Example
Luau
local part = Instance.new("Part")
print(cache.iscached(part)) -- usually true for the canonical wrapper
cache.invalidate(part)
print(cache.iscached(part)) -- false until that wrapper is cached again
part:Destroy()