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.

Syntax
Luau
cache.invalidate(instance: Instance) -> ()

Parameters

Function parameters
ParameterTypeDescription
instanceInstanceThe 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

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()
Kawaii documentation