---
name: wails_cache
kind: function
lang: ts
domain: core
version: "1.0.0"
purity: pure
signature: "class WailsCache { get<T>(key: string[]): T | null; set<T>(key: string[], data: T): void; invalidate(key: string[]): void; subscribe(key: string[], cb: () => void): () => void }"
description: "Cache reactivo para IPC Wails con invalidación por prefijo, suscripción a cambios y tracking de staleness. Singleton global."
tags: [wails, cache, ipc, reactive, state]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
output: "Clase WailsCache con métodos get, set, invalidate, subscribe para gestionar caché reactiva con invalidación jerárquica"
tested: false
tests: []
test_file_path: ""
file_path: "frontend/functions/core/wails_cache.ts"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/Bl4cksmith/Frontend_Library"
source_license: "MIT"
source_file: "frontend/src/lib/wails/cache.ts"
---

## Ejemplo

```typescript
import { wailsCache } from './wails_cache'

wailsCache.set(['users', '123'], userData)
const user = wailsCache.get<User>(['users', '123'])
wailsCache.invalidate(['users']) // invalida users:*
const unsub = wailsCache.subscribe(['users'], () => console.log('changed'))
```

## Notas

Key como string[] permite invalidación jerárquica: `invalidate(['users'])` invalida `users`, `users:123`, `users:456`, etc.
