Cache

cache.replace

Sets the cached Instance entry for one Instance to another Instance.

Syntax

cache.replace(instance: Instance, replacement: Instance)

Arguments

NameTypeDescription
instanceInstanceInstance whose Instance cache entry should be replaced.
replacementInstanceInstance value to store in the cache entry for the first argument.

Description

Sets the cached Instance entry for one Instance to another Instance.

Call it with 2 parameter(s): instance, replacement. The argument table explains which values are required and which ones only refine the behavior.

It does not return data. Treat the call as an action and handle errors around the call site when needed.

Example

Store one Instance as the cached entry for another Instance.

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

cache.replace(Players, ReplicatedStorage)

print(cache.iscached(Players))