Warn if cache key is too short

See #357
This commit is contained in:
Max Isom 2021-09-23 13:09:54 -04:00
parent a8676e6ebd
commit c23f04ba5a
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880

View file

@ -25,6 +25,10 @@ export default class CacheProvider {
expiresIn, expiresIn,
} = options[options.length - 1] as Options; } = options[options.length - 1] as Options;
if (key.length < 4) {
throw new Error(`Cache key ${key} is too short.`);
}
const cachedResult = await Cache.findByPk(key); const cachedResult = await Cache.findByPk(key);
if (cachedResult) { if (cachedResult) {