Skip to content

Instantly share code, notes, and snippets.

@lucasraziel
Created May 13, 2022 21:01
Show Gist options
  • Save lucasraziel/699643a219b808895fe4f1efc12cac2a to your computer and use it in GitHub Desktop.
Save lucasraziel/699643a219b808895fe4f1efc12cac2a to your computer and use it in GitHub Desktop.
FackeCacheProvider save Usando NPM Package para criar uma Arquitetura Limpa - Parte 2
async save(
value: Data,
prefix: string,
options?: SaveOptions
): Promise<void> {
this.cache.set(`${prefix}${value.key}`, value.data);
if (options?.ttlInSeconds) {
setTimeout(() => {
this.invalidate(value.key, prefix);
}, options.ttlInSeconds * 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment