Multiple set without any get calls, results in ttl mismatch
See original GitHub issueScenario
const cache = lru();
cache.set("foo", "bar");
// wait until TTL has passed
cache.set("foo", "baz");
const result = cache.get("foo");
console.log(typeof result === "undefined");
I do not expect the result to be “undefined”, but rather expect it to be the “baz” value.
The second set()
should IMO update the expiry property.
Failing test:
exports.multiSetWithTTL = {
setUp: function (done) {
this.cache = lru(4, 10);
done();
},
test: function (test) {
this.cache.set("foo", "bar");
setTimeout(function(){
this.cache.set("foo", "baz");
test.equal(this.cache.get("foo"), "baz", "should return baz");
test.done();
}.bind(this), 11);
}
};
Want a PR for this? This fix would require a breaking change? If this behaviour is expected, it should be documented in the README.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Automatic persisted queries - Apollo GraphQL Docs
Apollo Server supports APQ without any additional configuration. ... Many CDNs only cache GET requests, but many GraphQL queries are too long to...
Read more >IP Routing: OSPF Configuration Guide - Cisco
Configuring OSPF TTL Security Check and OSPF Graceful Shutdown. This module describes configuration tasks to configure various options ...
Read more >Caching challenges and strategies - AWS
Improving latency and availability with caching, while avoiding the modal behavior they can introduce.
Read more >Common Errors and Solutions | CockroachDB Docs
This message indicates that the cluster is using TLS encryption to protect network communication, and the client is trying to open a connection...
Read more >What is DNS TTL + Best Practices - Varonis
For example, if the DNS TTL is set to 1800 seconds (30 mins), ... that DNS site will receive a cached version of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanx again.
i can likely land this corrected implementation over the weekend or on monday.