Skip to content

open-nfse / ParametrosCache

Interface: ParametrosCache ​

Defined in: src/parametros-municipais/cache.ts:12

Cache plugável para respostas da API de Parâmetros Municipais. Implemente esta interface contra Redis, Memcached, DynamoDB ou qualquer outro backend se quiser compartilhar cache entre processos. A lib inclui createInMemoryParametrosCache() como default (Map em memória).

Contrato:

  • get retorna undefined em miss ou item expirado.
  • set guarda por ttlMs milissegundos a partir de agora.
  • As chaves são opacas — não assuma formato (a lib pode mudar).

Methods ​

get() ​

ts
get<T>(key: string): Promise<T | undefined>;

Defined in: src/parametros-municipais/cache.ts:13

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
keystring

Returns ​

Promise<T | undefined>


set() ​

ts
set<T>(
   key: string, 
   value: T, 
   ttlMs: number
): Promise<void>;

Defined in: src/parametros-municipais/cache.ts:14

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
keystring
valueT
ttlMsnumber

Returns ​

Promise<void>

Licença MIT — biblioteca não oficial, sem vínculo com a Receita Federal.