FwCache

Cache em memoria do framework TLPP. Reduz queries repetidas, acelera respostas. TTL configuravel.

Assinatura: FwCache():set(key, value, ttl) / :get(key)

Retorna: FwCache

FwCache e cache em memoria de processo. Util pra dados pouco mutaveis lidos varias vezes (lookup, configuracao, dicionario).

Sintaxe

// Guardar com TTL 300s (5 min)
FwCache():set("cliente:" + cCod, oCliente, 300)

// Recuperar
oCliente := FwCache():get("cliente:" + cCod)
If oCliente == Nil
    // Cache miss — buscar e cachear
    oCliente := U_BuscaCliente(cCod)
    FwCache():set("cliente:" + cCod, oCliente, 300)
EndIf

// Invalidar
FwCache():delete("cliente:" + cCod)

// Limpar tudo
FwCache():clear()

Quando usar

Pegadinhas

Veja também