I'm hoping that I'm just crazy on this one, but I'd love some input!
In my testing, if I set to the cache with;
.getOrSet({
key: 'testing_key',
ttl: '60s',
grace: '60s',
factory: () => {
console.log(`I've been hit`);
return 'Hello World';
}
});
And then wait 61s, the log "I've been hit" will be logged, as the factory is called again.
The documentation on grace periods leads me to believe this is a bug, as it says:
Grace periods allow cached data to be served for an extended time after their expiration
Curiously enough, if I also do;
.getOrSet({
key: 'testing_key',
ttl: '60s',
grace: '1s',
factory: () => {
console.log(`I've been hit again`);
return 'Hello World';
}
});
And then wait a total of 2s, the log "I've been hit again" will be logged.
I would expect to at least wait out the TTL before the factory is called again, regardless of the grace.
If this is intentional, maybe it'd be a good idea to note it somewhere in the documentation?
I've tried 1.5.0, 1.5.1, and 1.6.0 (Which isn't listed in this github, but is on npm)
I'm hoping that I'm just crazy on this one, but I'd love some input!
In my testing, if I set to the cache with;
And then wait 61s, the log "I've been hit" will be logged, as the factory is called again.
The documentation on grace periods leads me to believe this is a bug, as it says:
Curiously enough, if I also do;
And then wait a total of 2s, the log "I've been hit again" will be logged.
I would expect to at least wait out the TTL before the factory is called again, regardless of the grace.
If this is intentional, maybe it'd be a good idea to note it somewhere in the documentation?
I've tried 1.5.0, 1.5.1, and 1.6.0 (Which isn't listed in this github, but is on npm)