# Can we get all cache key entries made from \`localcachePut\`?

**URL:** https://forum.heroiclabs.com/t/can-we-get-all-cache-key-entries-made-from-localcacheput/6144
**Category:** Runtime Framework
**Tags:** typescript, server-framework
**Created:** [April 9, 2025, 7:01am UTC](https://forum.heroiclabs.com/t/can-we-get-all-cache-key-entries-made-from-localcacheput/6144 "2025-04-09T07:01:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KamilDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/kamildev/32/2454_2.png) [@KamilDev](https://forum.heroiclabs.com/u/KamilDev)
#### Post date: [April 9, 2025, 7:01am UTC](https://forum.heroiclabs.com/t/can-we-get-all-cache-key-entries-made-from-localcacheput/6144/1 "2025-04-09T07:01:35Z")

</div>

Looking at the API, the only available functions are:

```ts
localcacheGet(key: string)
localcachePut(key: string, value: any, ttl?: number)
localcacheDelete(key: string)
localcacheClear()

```

Is there no way to get an array of all cache keys? For example something like:

```ts
localcacheGetAllKeys()

```

If not, could it be introduced in a future Nakama version?

---

<div class="post-metadata">

### Author: ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)
#### Post date: [April 14, 2025, 11:07am UTC](https://forum.heroiclabs.com/t/can-we-get-all-cache-key-entries-made-from-localcacheput/6144/2 "2025-04-14T11:07:20Z")

</div>

Hello @KamilDev,

Can you elaborate on why you’d need to list all keys? What are you using the cache for?

Best.

---

<div class="post-metadata">

### Author: ![KamilDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/kamildev/32/2454_2.png) [@KamilDev](https://forum.heroiclabs.com/u/KamilDev)
#### Post date: [April 18, 2025, 11:06pm UTC](https://forum.heroiclabs.com/t/can-we-get-all-cache-key-entries-made-from-localcacheput/6144/3 "2025-04-18T23:06:12Z")

</div>

I’d like to enumerate over them, for example get only cache keys that have a specific prefix (e.g. `equipment_templates_v`) to clear all versions of cached `equipment_templates`.

I’m still just experimenting, perhaps it’s not the best approach. Here are my related posts:

> [@Best way to handle versioning?](https://forum.heroiclabs.com/t/best-way-to-handle-versioning/6143):
>
> Overall, what’s a good way to go about handling versioning? Lets take one example from my game. Equipment information, such as stats: Equipment template: { "id": "weapon\_iron\_sword", "type": "weapon", "baseStats": { "attack": 10, "attackSpeed": 0, }, "levelScaling": { "baseMultiplier": 1, "multiplierPerLevel": 0.1 }, } For players actual inventory, it’s just: { "id": "1bdca98f-e1e4-4988-826f-10fa70b5f748", "level": 1, "rarity": "epic", "templateId": "weap…

> [@Handling mostly static config data: database, JSON file, \`localcachePut\`?](https://forum.heroiclabs.com/t/handling-mostly-static-config-data-database-json-file-localcacheput/6140):
>
> For handling mostly static config data, how do I go about determing if I should use: Database (nk.storageRead) JSON file (nk.fileRead) Cache (nk.localcachePut) I noticed that we could clear/invalidate cache using: nk.localcacheClear() // all cache nk.localcacheDelete("some-key") // specific cache Theoretically, couldn’t we get the best of both worlds by utilizing database to store static configs, which gets put into cache at server startup, and then have an admin RPC that can clear the cach…
