> For the complete documentation index, see [llms.txt](https://ans-dev.gitbook.io/datareplicator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ans-dev.gitbook.io/datareplicator/api-reference/client-side-api/getcached.md).

# :GetCached

Retrieves data instantly from the client's local cache for a `realKey` that has been previously received via [`:Request()`](/datareplicator/api-reference/client-side-api/request.md) or [`:Listen()`](/datareplicator/api-reference/client-side-api/listen.md).

This function is synchronous and does not yield or perform any network requests, making it the most performant way to access data you know the client already has.

***

**`DataReplicator:GetCached(realKey: string)`**

***

{% tabs %}
{% tab title="Parameters" %}

* `realKey`: [string](https://create.roblox.com/docs/luau/strings)

  The original data key.
  {% endtab %}

{% tab title="Returns" %}
`any | nil` - The current cached data, or `nil` if no data for that key exists in the cache.
{% endtab %}

{% tab title="Example" %}
{% code title="GetCachedData.luau" %}

```lua
-- Sometime after requesting or listening to player health...

local function onPlayerTakeDamage()
	-- Instantly get the current health from the local cache.
	local currentHealth = DataReplicator:GetCached("PlayerData_12345.Health")
	
	if currentHealth then
		-- Use the cached health value for immediate UI feedback.
		updateHealthBar(currentHealth)
	end
end
```

{% endcode %}
{% endtab %}
{% endtabs %}
