Created
May 13, 2022 21:01
-
-
Save lucasraziel/699643a219b808895fe4f1efc12cac2a to your computer and use it in GitHub Desktop.
FackeCacheProvider save Usando NPM Package para criar uma Arquitetura Limpa - Parte 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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